weixin_33701564 2009-10-01 12:02 采纳率: 0%
浏览 36

Ajax调用还是UpdatePanel?

Inside a web application that we are developing, there is a time in where the user commits a search by providing some parameters (it's a reservation system, so "parameters" = 2 dates).

A hidden table (or, better, empty) is then filled with the results of the query.

Now comes my problem: is it better to do an AJAX call to a WebMethod, or just let the "Search" button inside an UpdatePanel and update it server side?

In this post, Encosia points out that everything in the panel is updated each time an asynchronous postaback is made.

So, given the fact that this application has to be as fast as possible, and should use the lowest amount of bandwidth, i went for the AJAX approach.
In this way i lowered it from 40-60KB to ~1KB (MAX!) each search.

The execution is "Search button click" -> Ajax call to WebMethod -> JSONed result read and JQuery HTML-injected inside the table.

There are however some problems with this approach, with the bigger being hard to maintain code (client-side performance is not a big problem, it takes ~ 12ms to build the table).

  • 写回答

2条回答 默认 最新

  • weixin_33721344 2009-10-01 12:11
    关注

    I don't think I'm seeing the question here.

    UpdatePanel is very easy to use/abuse/maintain but effectively posts back the whole page asynchronously.

    AJAX may be slightly harder to maintain/involves more setup/boilerplate code, but sends and receives less data and therefore uses less bandwidth. It should be more performant than UpdatePanels, but whether this is significant depends on a number of different factors (number of controls, page size, ViewState size, etc).

    The choice is whatever fits your situation best really. What are the feature priorities of the application? If performance/bandwidth ranks over maintenance, go for AJAX. If maintenance and speed of development is importnant, maybe the choice is UpdatePanel. If this is an Intranet Application, I'd probably be less concerned about using UpdatePanels.

    评论

报告相同问题?

悬赏问题

  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误