开发者

AJAX in a .NET 3.5 Environment(web forms)

I'm curious as to what pattern the community uses to make AJAX calls in a 3.5 setting. Patterns may be the wrong term to use here, but I've started working in an AJAX environment(been a while) and there's a few new options.

Originally(quite a few years ago), I would write up a function using XMLHttpRequest and use an *.aspx or *.asmx page/service to return an array of results. More recently I've been using UpdatePanels, but have started to move to a jQuery based enviroment.

Background aside, I've come across being able to setup an "开发者_开发百科Ajax Enabled Web Service" which lives inside a web application and creates methods directly accessible from javascript calls(provided they are registered with the current ScriptManager).

I'm not asking if WCF to serve up responses is necessarily best practice, but rather, what does the community do in a web forms environment? Do you instead create call back pages that serve responses via code behind? How do you handle json serialization?

Just a novice looking for the path recently paved.


I don't feel that you will find some industry standard or best practice on this topic. When it comes to AJAX, people tend to write code or use products that they are comfortable with.

For example, my first AJAX experience was similar to yours in writing the XMLHttpRequest handlers, etc. I then moved onto Microsoft's AJAX Control Toolkit, jQuery, and have now been using the Telerik product.

At this point for WebForms, I will primarily use UpdatePanels and the Telerik Product. Its very easy to AJAXify grids, etc. with these frameworks. For an ASP.NET MVC Application, I would probably use web services along with jQuery.


Adding an alternate solution here with the direction I've ended up choosing.

I've become a bit more particular in using stock html elements(mostly an MVC influence) and have chosen to send AJAX requests to a variety of .ashx handlers, which in turn handle any server side requests that need to be made.

jQuery.getJSON(...) was a handy tool to make this a pretty easy transition.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜