jQuery UI + ASP.NET UpdatePanel - Is it worth it? - asp.net

I really like the looks of jQuery UI and I'd love to integrate it into my ASP.NET Web Applications. I like the themes and how easy it is to use the widgets. I'm currently using AJAX Control Toolkit controls like the Calendar and ModalPopup. I'm hoping to replace them with the DatePicker and Dialog widgets, but I hear they have issues with UpdatePanels. There are workarounds for these issues, but I wonder, is it worth it?
Which leads into my question(s):
Has anyone had luck using jQuery UI widgets exclusively (instead of AJAX Toolkit Controls) in an ASP.NET Web Application that occasionally uses UpdatePanels?
Are there any best practice resources for getting jQuery UI and UpdatePanels to play nice?
Update:
Based on the answers so far, it seems that the best thing to do is replace UpdatePanels with $.ajax and PageMethods. That should allow me to use jQuery UI without any issues and also improve my AJAX performance.

No, it's not worth it. If the toolkit's calendar and modalpopup extenders are working for you, then just hold on to them.
In future projects, stay away from asp.net ajax and use jQuery exclusively. This way you wont run into any of the updatepanel problems. ASP.NET 4.0 Webforms are going to make using jQuery much easier in the past, because you will have more control of how controls get named when they are rendered to HTML.

We use Microsoft AJAX (only using UpdatePanels) and jQuery and all works great.
Using UpdatePanels makes all UserControls, Postbacks, Viewstate etc work as you would expect with the UI enhancements of jQuery. There are a few things to learn in getting them to work together and until we find an alternative we will continue to do this. We think its worth it.
I would be keen to see how UpdatePanels can be easily replaced with jQuery, but I expect one would need to write additional code for each UpdatePanel replacement, rather than letting asp.net handle things? Are there any articles out there that demonstrate replacing UpdatePanels that contain asp.net controls and UserControls with events etc?

I'm working on a project with a lot of UpdatePanel and jQuery, things just work fine.
Yes, it is a period when you need to learn, to make things work.
If you have a lot of UpdatePanels and you don't want to remove them then this is understandable, and using jQuery is just improving the UI, so it's not going to much worse.
Also jQuery has functionalitys related to AJAX,so you can make elegant client side coding with jQuery which is not related to Design and ui stuff.
I think if you search for jQuery and Ajax on the internet you will find a bunch of good examples, and fine techniques to both technologies together.
PS:
Remenber that UpdatePanel is evil in sort of way when you are using in an inappropriate way.
UpdatePanel is (and generally AJAX) is very customizable, make time for yourself to optimize it
Good luck!

Related

Using jQuery-AJAX to page ASP.NET datagrid

Does anyone have, or could point me to, an example of using jQuery to page through an ASP.NET datagrid control?
I would like to page through a large set of data displayed by an ASP.NET DataGrid control however I would like to avoid a page refresh and hence want to use AJAX to get the new sets of data. I would also like to avoid the ASP.NET AJAX toolkit and would like to do it all using jQuery-AJAX. Thank you.
The DataGrid is a server side control that relies on postbacks. jQuery and AJAX are client side technologies. Write a AMSX or WCF service to serve up your data and consume it with jQuery. You can use jQuery templates to make things easier. Or wrap the DataGrid in an UpdatePanel and you will have the poor man's AJAX(sometimes called AJAH).
There may be a jQuery plugin to help with this.
Here's a nice article to get you started:
Easily build powerful client-side AJAX paging, using jQuery
Try using jGrid, it´s free, but there are commercial dotnet implementations available.
It´s quite powerfull,you can do almost everything with it. And loading your data is easy to. But, you have to forget the Idea of aspnet datagrid, unless you will use updatepanel(which is very stable and usefull and has nothing to do wiht asp net ajax toolkit)

Replacing ASP.NET Ajax controls with jQuery

I have a solution that uses Accordian and tab controls, amongst others.
Is it worth swapping these out and use the jQuery controls instead?
What are the benefits? Is it best practice to load one tab at a time with data?
There are obviously benefits to using both, but in my experience if you are using ASP.NET then you are going to find the (I'm assuming you meant Ajax Control Toolkit) the ASP.NET controls better if you have a requirement for data-binding or have a high tendency to utilise your server execution time a lot.
IMO if the current controls meet your requirements then there isn't a breaking reason to switch to the jQuery controls, some ASP.NET server controls that provide Ajax functionality can be quite heavy-weight and cumbersome, but I've found controls like the Accordion to fit my needs perfectly, and wouldn't see a need to switch unless it wasn't flexible enough.
I had to make this swap in some test on my projects, from ASP.NET Ajax controls to jQuery controls, and my only issues was the UpdatePanel's.
ASP.NET take care the UpdatePanel messages (when you make asynchronous calls), but if you going to change it with jQuery you need to take care this updates by yourself - if you use UpdatePanel.
Update.
I agree with the comments for the UpdatePanel. I was working on a project, that had already many upadtePanels, and we just started to change some things to see what and how. If you build it up from the beginning I agree that it's better to avoid UpdatePanel, and do it with jQuery.

Using update panel in AJAX a good practice in asp.net?

Using update panel in AJAX a good practice in asp.net ??? ... or one should code himself for AJAX for each and every control using HTTP-Object ? In which scenarios are the above two strategies used ???
The Update Panel is a good thing in that it allows the developer to code AJAX very simply. It has a lot of overhead, though, and I would not recommend it as a solution in most (if not all) cases.
Look into ASP.Net AJAX for a good way to get started using AJAX. Its fairly simple, robust, and flexible. (It doesn't prevent you from using the update panel either).

Any suggestions for a nice ASP.NET Ajax tooltip?

I am looking for a nice tooltip control (with delay) in ASP.NET AJAX. I know there are many nice Javascript libraries out there, but since I am already using ASP.NET AJAX, I may just as well use that.
An "oldie-but-goodie" that I have used many times for tooltips would be overlib It's quite nice, VERY flexible and can be used independent of any particular AJAX platform.
Telerik seems to have the mojo in this area, but since I assume you're looking for free...
The nicest ones appear to be jQuery plugins, like this one:
http://rndnext.blogspot.com/2009/02/jquery-ajax-tooltip.html
There is also this ASP.Net AJAX TooltipExtender:
http://weblogs.asp.net/cjdevos/archive/2008/03/29/asp-net-ajax-tooltipextender.aspx
I was able to make a pretty nice balloon popup using the PopupControlExtender from the ASP.Net AJAX Control Toolkit. You can specify the target control to invoke the popup, the control or div that contains the popup content, and you can also dynamically populate the content using an AJAX callback to a service method.
I recommend:
Pure JavaScript with Ajax capability:
Menucool Tooltip
ASP.NET version, with Ajax Load On Demand:
Menubasic Tooltip
If you don't need the Ajax feature, Menucool has a very easy-to-use CSS tooltip either.
One option is WZ_Tooltip. Most tooltips are basic javascript; you should not expect to find much in the way of .NET integrated tooltips, since there is not much reason to use it rather than just using a javascript.

Dealing with ASP.Net Custom Controls in MVC

I have looked around on the Internet trying to answer this question. It seems to be kind of complicated though! Seems to come up with all sorts of different topics such as the HtmlHelper and other stuff.
Basically. How can you use custom controls with MVC? In a way that avoids doing anything that is frowned upon.
Also, Is it true that with MVC you have to put some simple logic IN THE PAGE? Isn't that what we should be getting away from?
Update: So, Seems you cannot use controls which depend on anything which MVC does away with, such as the postback events and viewstate. Can you make your own then? A control which does only rendering of course.
Can you use ASP.NET controls? Maybe. If the control does not use ViewState or postback events, it will probably work. For example, the LoginView control works just fine. Telerik supports ASP.NET MVC with some of their controls. On the other hand, if the control needs either ViewState or postbacks, then it just isn't going to work. Controls with data binding aren't ideal, since you typically have to use code behind him up. But they will work, if you add code behind.
On the other hand, controls with no knowledge of ASP.NET (such as the jQuery UI controls) work very well.
No, you don't have to put your logic in the page. You just don't put it on a code behind page, either. Instead, use helper methods.
With respect to the second question, the page is exactly where view logic should go. Any other logic should be in your controllers or models.
I'm not sure what you mean by custom controls. You can have ViewUserControls that are rendered via partials to reuse view code. If you are talking about 3rd part controls built for webforms, it's likely they won't work -- at least for awhile. If you absolutely must have them, though, there are ways to mix MVC with traditional webforms in the same site.

Resources