jQuery vs ASP.NET Ajax - asp.net

What are the differences between jQuery and ASP.NET Ajax?

They are very separate things, jQuery is a JavaScript framework that has the ability to do some rudimentary Ajax functionality while ASP.NET Ajax is a more fully-featured Ajax framework that encompasses .NET controls and server-side aspects as well as client-side aspects.
jQuery's main focus is on a creating standard, stable, and powerful framework for working with JavaScript as a whole in the client.

Albeit ASP.NET AJAX encompasses a client side framework it is perhaps best known/feared/loathed for its server side controls, particularly the UpdatePanel. What you get with ASP.NET AJAX is out-of-the-box AJAX for the most basic stuff without having to write a single line of JavaScript.
If on the other hand you need to write some JavaScript or go a little out-of-the-box, working with ASP.NET AJAX can soon become a little tedious.
jQuery on the otherhand is lightweight and requires you to write JavaScript, although for most part, the jQuery guys has done a very good job of hiding the ugly JavaScript stuff away, so apart from a small learning curve it comes pretty natural (particularly if you are on home-stretch in CSS selectors).
Main problem in using jQuery with ASP.NET can be if you mess too much with the DOM you might get ViewState/Event validation problems.

jQuery is a standalone javascript library that can be integrated into any development environment. It it widely used and many great plugins exist for it.
It can be used for much much more than just AJAX functionality. Like traversing through current elements and changing their functionality.
ASP.NET AJAX is something else entirely, since it only focuses on AJAX like functionality in the .NET environment.

Main goal of ASP.NET Ajax is calling ASP.NET web services from client using simple JavaScript notation. It also provides client access to some ASP.NET server features. Like profile, for example. All other operations it's better to perform with jQuery.

i used Ajax Control Toolkit from microsoft quite extensively for 2 years before i switched to jQuery and in my experience i think jquery ajax calls are much more light weight, efficient compared to the ajax control toolkit libraries. besides that the efficiency ofcourse depends on the data that you send & receive via your ajax calls.
you can add custom HTTP Status codes in jQuery ajax calls as well to capture any errors on the server and returning the appropriate response.

#Andrew and #Ólafur hit the nail on the head, but I would add that the biggest concept that separates these two approaches to ajax development is that w/ jQuery you get total control of what happens between the client and the server. With the MS AJAX Toolkit you give up any control over what is sent between these 2 points. If you want to be "close to the metal" you would be best to choose jQuery. If you are just working up some quick and dirty solution that needs zero customization and speedy delivery is all your client cares about, maybe take a look at the MS AJAX Toolkit.

by the way - scott gu officially announced that asp.net would include support for jquery (full intellisense too) with their ajax framework (which is really bloated)
check this link - http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx
if you have used ms ajax, you would be aware its really really bloated up, and many things which ms ajax does - you can achieve via jquery writing few lines of javascript code, and you would save a lot on bandwidth and performance
you can even call asp.net json + xml web services via jquery writing just few lines of code

Related

What is the intended use case of a RadAjaxManager w/ Ajax requests versus an UpdatePanel/RadAjaxPanel

I'm confused at the benefits of using RadAjaxManager with Ajax requests versus using and UpdatePanel/RadAjaxPanel.
I have both in my solution and it is creating some havoc. What design methodologies are typically deemed best (a bit subjective I realize)
Should I only perform data operations using Ajax and all GUI updates using UpdatePanels/RadAjaxPanels?
Currently I am sometimes updating controls via Ajax manager triggered by ajax request and sometimes a control will postback entirely. If I decide to do everything via Ajax, do I have to make sure nothing ever posts back?
Check official statement. I think that mixing MS Ajax with Telerik is not a good idea.

ASP.NET Ajax Control Kit versus JQuery

During the last 2 years JQuery has become more and more popular. So do you think, it is now time to prefer JQuery to ASP.NET Ajax in ASP.NET projects with Ajax? Has the ASP.NET Ajax Control Kit a future in the ASP.NET world?
Short answer:
If your page/site isn't currently depending on the UpdatePanel or ACT controls, definitely use jQuery and jQuery UI for any new work. That's even Microsoft's own recommendation now.
Long answer:
It's important to be clear about terminology when dealing with this topic.
ASP.NET AJAX is part client-side, but also part server-side. System.Web.Extensions came from Atlas and was eventually integrated into ASP.NET 3.5. Even if you don't use a ScriptManager or MicrosoftAjax.js, the server-side portions of ASP.NET AJAX are still very useful for creating JSON-based server-side endpoints (and those may be called directly from jQuery, with no ScriptManager).
jQuery and MicrosoftAjax.js are somewhat similar, but both do things that the other doesn't. It's not strictly accurate to say that they compete with each other; they have different goals. If your application has any UpdatePanels, you have no choice but to include MicrosoftAjax.js (which is coming in automatically with the ScriptManager). jQuery and MicrosoftAjax.js do play nice together though, so you can still use jQuery's more powerful selectors, traversals, and animations in conjunction with UpdatePanels if you must.
The AJAX Control Toolkit (ACT) is a different project, entirely separate from ASP.NET AJAX. It most directly compares with jQuery UI, not jQuery core itself. Going forward, I think we'll see most of the client-side-only AJAX Control Toolkit controls refactored as jQuery plugins (that already happened late last year, but they were pulled).
Ultimately, it's best to favor jQuery or jQuery UI over MicrosoftAjax.js or the ACT if an equivalent solution exists in both. However, if you're tied to MicrosoftAjax.js with UpdatePanels or other existing code, don't be afraid to mix jQuery with that and transition to jQuery slowly. They work great together.
jQuery is the more popular, mainly because it is platform independent, but it's a good system in it's own right.
I don't think that there is anything wrong with ASP.NET AJAX for those developing on Microsoft platforms either.
I've used both, but I'm erring towards jQuery now, mainly because of the resources and samples available out there.
Does that mean the MS offering is doomed? Not yet. It will exist for as long as a certain number of people are using it, but I think it will always play second-fiddle to jQuery.
If you are an ASP.NET-only developer, have a peek at both and use whichever suits you best. If you develop on different platforms, then settling on jQuery might be more advisable.
PS. there are other cross-platform AJAX frameworks out there also...
In my opinion, jQuery is leaps and bounds better than the Ajax Control Toolkit. The main reason for me is the great back-up the community has given it. Not only is the jQuery documentation on the web better, but by jQuery not being a .NET-centric framework, the community is bigger, meaning that anyone from a Ruby on Rails developer to a PHP developer can help you with your code just as good as a .NET developer, which would be obviously harder to find.
Other than that, I've had better performance than the Toolkit, and I find it a whole lot easier to write against and customize. And you got to love jQuery UI.
By the way, be aware that by simply enabling the ScriptManager on your ASPX page, your loading a bunch of scripts which add extra load to your page. Something to have in mind before mixing up jQuery and the Toolkit.
I think that ASP.NET Ajax Toolkit is using jQuery under the hood. (this is wrong).
You may use both. I guess it depends on what you prefer, because Ajax Toolkit provides controls that you can use server side, while jQuery will always be client side only.
So you'll probably use both : when a control exist in Ajax Toolkit and you need some server side properties / accessors, etc. use it, if you need some functionnalities that aren't provided by the Toolkit, use pure jQuery.
Microsoft is working with the jQuery community and submits some patches to them. So I guess they'll continue to maintain the Toolkit. Ajax Toolkit being only a layer over pure jQuery functions and providing server-side controls.
Update:
Interesting quotes from this blog:
However, with Visual Studio 2008
Service Pack 1, we also added support
for the ever increasing popular jQuery
library. That is, you can use jQuery
along with ASP.NET and would also get
intellisense for jQuery in Visual
Studio 2008.
And :
For client side programming using
JavaScript for implementing AJAX in
ASP.NET, the recommendation is to use
jQuery which will be shipped along
with Visual Studio and provides
intellisense as well.
For server side programming one you
can use the server controls like
UpdatePanel etc., and also the AJAX
Control Toolkit which has close to 40
controls now.
ASP.NET Ajax and the ASP.NET Ajax toolkit are two separate things. The toolkit is a set of ASP.NET controls (and some other stuff). It's server side code and some javascript.
ASP.NET Ajax is an application framework you can use to create and manage client side controls; it's Javascript. The ASP.NET Ajax toolkit is based on this framework.
jQuery and ASP.NET Ajax have some overlaps in functionality but they are by no means mutually exclusive. jQuery is mostly geared towards updating and manipulating markup. ASP.NET Ajax is geared towards providing an application framework.
Microsoft has recently decided not to compete with jQuery but invest in it because jQuery and ASP.NET Ajax work well together and complement each other. JQuery is actually shipped with Visual Studio.
So, to answer your first question, you should use the JavaScript lib best suited for the job, be that jQuery or ASP.NET Ajax.
Whether you want to use the Toolkit, that depends on how much you like wrestling with ASP.NET controls. If you're into lean-and-mean coding like ASP>NET MVC, I'd drop it like a hot potato. If your in a traditional WebForms project, the toolkit is probably as good as it's going to get.

Most stable solution for doing AJAX with ASP.NET as a backend?

I'm planning a ASP.NET project for which I'm going to use AJAX. I'm researching all the available technologies for doing so in the .NET world.
I need a solution that is well documented and stable.
The current solutions I've found are:
1. ASP.NET AJAX UpdatePanel
2. ASP.NET AJAX with Web Services + JQuery
3. JQuery + Http Handlers
In the second and third solutions the backend would only send JSON or XML messages to the client.
In my experience the best way to go is JQuery with WCF with JSON webservices.
The reason is:
ASP.NET ajax is gives you alot for free in terms of coding but is bloated from the start and needs to be stipted and slimed. On the other hand you have JQuery that you needs more development but is light weight. JQuery has a great plugin library as well.
XML is to slow, JSON is fast.
Thats how I would do it today.
All will work but I've had most performance and stability with using JQuery and a script service.
An update panel will work but as its designed to work in the general case it can be a little bloated if you aren't careful. One reason being is that it posts the viewstate back with each update.
I recommend you check out the site: encosia.com as it has a number of posts on how to use script services and page methods. Then you can make a more informed decision. I would say that I've not used page methods and probably won't but that's entirely for personal reasons.
One other thing to consider will be any mvc you may end up doing. The general consensus is that it's a whole lot easier with JQuery. Added to that Microsoft have officially adopted it and also provide intellisense in VS2008.
All compelling reasons to include at least some of it in your project. In mine I only use the built in ScriptManager when I absolutely have to.
HTH!
S

ASP.NET webforms without javascript

Due to a security requirement all browsers that will run a web application we need to create must have all client side scripting disabled. So that means no Javascript.
Unfortunately Web Forms make quite some use of Javascript. The login control works without Javascript, but a button does not (it calls the Javascript function __doPostback()).
So to make it work we'd need to program all the forms by hand (the ASP Classic, or PHP method). But I was wondering if there is a framework available for ASP.NET that offers the normal ASP.NET controls (treeview, gridview, etc) with all the functoinality they have, but that doesn't use Javascript and doesn't require the programmer to program massive amounts of logic?
Update:
For clarification, I know ASP.NET MVC is an option that will help a bit, but it won't give me a nice GridView. So I'm wondering if there is a 100% functional, 100% no-javascript replacement for the standard ASP.NET controls.
Thanks.
Update2:
It's been a while and I never found the exact answer I was looking for. Probably because what I want doesn't exist. So I'll go for ASP.NET MVC which is the next best thing.
ASP.Net MVC is probally the closest you'd get. You can use it to build a site without javascript. It is very different from Web forms
Many of the stock controls will be problematic. They just depend too heavily on Javascript. You do have some options, though:
ASP.Net MVC should give you a bit more control over your html
You can build your own replacement WebForms control library that doesn't rely on javascript to provide alternatives for controls that do.

What is the difference between Microsoft AJAX and AJAX Pro?

What is the difference between Microsoft AJAx and AJAX Pro?
Also, for what should I use AJAX Pro?
Microsoft AJAX is Microsoft's Ajax library that contains ready to use server controls.
AJAX Pro is a free AJAX library, that enables you to implement your Ajax calls manually. It's a little bit difficult to use then Microsoft's controls. But you have more control on the data and html elements with this library.
With AJAX Pro, you define AjaxMethods, and call them in client-side. with callback methods you get the return value and implement your logic. Whole serializable .NET objects converted successfully to javascript objects.
In Ajax Pro when you make an ajax call, only the method you defined is called. In Microsoft Ajax, whole page life-cycle called instead. Because of this, you can not change properties of controls on page with Ajax Pro. You should do it manually by callback functions in javascript. But in Microsoft AJAX, you have ability to change control's properties in Ajax methods.
My suggestion, if you have knowledge of Javascript and HTML, try Ajax Pro or JQuery for AJAX. But if you're a newbie, begin with Microsoft Ajax.
if you like the way AJAX pro works then i suggest you look at www.coolite.com, they are amazing controls, the people there took EXTJS and did all he pluming work for you and you have great fast controls, where you can also define Ajaxmethods, Webmehtods.
also if you really want to use Microsoft Ajax, then i advise using Teleirk Ajax Controls set, it is built upon Microsoft Ajax framework, but with enormous options and great support, i personally use them everyday.
hope this helps.
I think the developer of Ajax Pro went on to work for Microsoft when they built Atlas.

Resources