ASP.NET Webforms with jQuery?

Can I avoid using MS AJAX completely when developing ASP.NET Webforms applications and use jQuery / jQuery Tools instead?

jQuery seems much faster, has a better community, extremely small file size (24kb). It also seems like an obvious choice for developing ASP.NET MVC.

But what about webforms? I would prefer not to use the AJAX Tools that ships with Visual Studio 2010. Can jQuery provide me with everything that the default AJAX controls can offer ?

Thanks!

+6
jquery ajax asp.net-mvc
source share
4 answers

Can you use jQuery with web forms? Yes, this is not a problem - at the end of the day, all the configuration of web forms generates HTML pages and, therefore, jQuery can manage them.

Can jQuery provide all AJAX controls by default - yes, theoretically, because ultimately everything they do is: a) manipulate the DOM and b) make out-of-band calls to the server. In practice, you will give up any ease of use, and you will have to do more work on your own.

The biggest problem - at least with applications running prior to .NET 4.0 - is that identifiers generated for server controls are interesting. If you can do everything you need in jQuery without reference to the identifier of the control (if you can use classes or look for control types), you go away and run, but if you need to clearly indicate the identifier, you need to emphasize it if you don’t can use .NET 4.0

I have code that mixes the bits of two (dynamic data sites that use the jQueryUI calendar, as it is much better than a toolbox) and, of course, will consider using more jQuery materials in form applications.

+6
source share

Yes. You can. But you need to use many jquery plugins for different functionality.

In one of our projects (asp.net webforms) we initially use MS Ajax. Now we are slowly moving to jquery with success.

+3
source share

It depends on the required development model. jQuery requires the use of Web services for communication, while MS AJAX can handle implicit postbacks. Although the latter is convenient for rapid development, using web services to exchange data is best practice.

Most MS AJAX controls can be simulated using different jQuery libraries.

+3
source share

Short answer: Yes. And as prompted by the answer to the railway, Microsoft supports that.

The only thing you have, as you probably know with Webforms, is that you cannot control which client-side identifier your controls will receive, making the selection via $ ('# id') cumbersome.

I usually get around this using CSS classes to select or retrieve the ClientID property of controls in the code when necessary (for example, when I need to reference a dynamically created control in a repeater).

+2
source share

All Articles