开发者

ASP.NET Web Forms + jQuery

So, I have been programming with ASP.NET MVC with jQuery for quite some time and am very comfortable working with the DOM for AJAX and programming interactivity.

However, I recently started a new job that uses ASP.NET Web Forms, and I was wondering if there is any way to rely on using开发者_开发技巧 jquery for all my AJAX and DOM manipulation as opposed to using POST backs.

I really wish I could use ASP.NET MVC, but I was hoping to find a good middle-ground. I want to have jQuery, plugins and my own client-side code to handle DOM manipulation once the page is loaded.

I was thinking I could use simple controls like repeaters to write out my HTML. I guess I want to avoid all the bloated code the web forms engine adds and use the unobtrusive approach of separating front-end with the back-end better.

Hope my question makes sense.

Thanks!


Joe Stagner who made a lot of training videos about the Ajax Control Tookit has started an ambitioned project on his blog to replace the features of the Toolkit by JQuery alternatives for ASP.NET webforms projects:

I’ll be doing jQuery alternatives for ALL my Microsoft Ajax and Ajax control toolkit videos.

I think the first post he made about this project is this one:

http://www.misfitgeek.com/asp-net-rounded-corners-jquery/

All other blogs he published in the meantime can probably easiest be found under his "act" tag or "jquery" category (they likely will overlap):

http://www.misfitgeek.com/tag/act/

http://www.misfitgeek.com/category/jquery/

Edit

(Links fixed to new domain.)

Update: Joe Stagner is not working anymore at Microsoft. The project mentioned above is only a fragment and will probably never be finished.

NOTE (18/02/2022): The above links appear to have either expired or been hacked. I've modified them to point to Joe Stagner's Microsoft blog, instead, despite his not working there any longer.


We use web forms where I work, and I end up using ALOT of web methods. I followed this way of doing it and it works out pretty well.

http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/

Basically you can call the web method from JQuery's ajax call like so

url: "PageName.aspx/MethodName"

It got rid of having to use a ton of updatepanels and having needless postbacks.


You can most certainly use JQuery with ASP.Net. One thing I have noticed is that if you use Updatepanels as well as JQuery, things may collide. Like in the JQuery Dialog . Barring that, I found this link to be useful when I started off with JQuery in web forms.


You can certainly use Jquery to do your Ajax (using the static page methods or a web service) and DOM manipulation.

But I don't think you can completely avoid posting back, which is how web form post data back to server.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜