-
Really interesting read on update panels and web methods/services
I was looking through a thread from April 2009 and came across this post
Quote:
Originally Posted by
wey97
Autopostback checkboxes (or anything autopostback) even on an update panel aren't a good idea IMO. If you use validators, you won't need to post back to see the check.
Unfortunately, there is no validator to force a checkbox check but it's simple to write one using a custom validator. There are plenty of examples if you search.
Just a word of warning, but update panels aren't the magic they're made out to be.
http://msdn.microsoft.com/en-us/magazine/cc163413.aspx
The link to the MSDN article is quite a good read.
Do you all use a lot of web methods and services to avoid update panels?
-
Re: Really interesting read on update panels and web methods/services
Hello there,
In my opinion, the Ajax Update Panel, when used correctly, does have it's place. However, it has started to get a bad rep by people trying to use it in situations where it doesn't belong, and in a way that it was never intended. Also, there is an element of "bloat" to the page, in using AJAX Update Panels.
Since the advent of the jQuery JavaScript Library, working with items on the client side, and making Asynchronous Calls back to the server, has become a LOT easier, so you are starting to see a shift towards this technique.
If I was starting a brand new application from scratch, then I think I would go down this route, rather than using AJAX UpdatePanels.
Gary
-
Re: Really interesting read on update panels and web methods/services
Quote:
Originally Posted by
gep13
...If I was starting a brand new application from scratch, then I think I would go down this route, rather than using AJAX UpdatePanels.
Gary
Thanks for that - I am starting a new application and I think it's time to fully investigate this.
-
Re: Really interesting read on update panels and web methods/services
I 100% agree with Gary. I have never put asp.net AJAX, updatepannels etc into production. To me they are a RAD tool based on existing technology and I never wanted to invest the time to become an expert in the finer details.
jquery now deploys with asp.net, intergrates beautifully and is universally accepted. I give it 2 thumbs up.
FYI here is a great free jquery UI plugin (jquery tools) http://flowplayer.org/tools/
-
Re: Really interesting read on update panels and web methods/services
Quote:
Originally Posted by
brin351
That is really good stuff - do you use this regularly? I saw just the demo for tab'd panes - that is incredible. Is it really that easy to make that happen client side. I've done nothing with jQuery - what is it all about?
-
Re: Really interesting read on update panels and web methods/services
There are some good blogs, tutorials on the basics of using jquery, jquery ajax with .net etc by the .net people and others here is a tut on getting started http://www.west-wind.com/presentatio...y/default.aspx
The great thing about jquery is it is easy to use and takes care of cross browser issues and generally makes life easyer for you. Then there are the plugins like that link, yes I've put some of those into production (the scroller, tooltips etc). Creating nice client UI's with javascript can be painful and hard to debug.... jquery to the rescue...
-
Re: Really interesting read on update panels and web methods/services
The good thing about jQuery is that Microsoft is now heavily investing in it, and actually providing source code for it, so things "just work".
You can do some really nice things with it.
Gary
-
Re: Really interesting read on update panels and web methods/services
Quote:
Originally Posted by
brin351
Noice!! Going to have to have a play with this!!
Gary
-
Re: Really interesting read on update panels and web methods/services
Quote:
Originally Posted by
gep13
Noice!! Going to have to have a play with this!!
Gary
For a plugin I like the fact you get a whole range of components in one package as apposed to having 1 plugin to do this and another to do that.
-
Re: Really interesting read on update panels and web methods/services
So guys.What should i use as an update panel with jQuery?Any article?
-
Re: Really interesting read on update panels and web methods/services
UpdatePanels come with a lot of overhead - they send the entire page back as if it's a full postback. You have to understand the overhead of all this.
Two years ago we made a complex site with a datagrid with updatepanels and lots of other ajax. It's bloated and runs poorly. Had I know that this would be the end result I would have invested in developing web methods to feed my own JS functions that did the same thing as UpdatePanels without all the overhead.
It's all about scaling - using an UpdatePanel with a simple page makes sense. Using an UpdatePanel with a grid that can grow to hundreds of rows simply does not scale. Had we tested with some of what became reality for "data size" maybe we would have caught it earlier...
The UpdatePanels use JS to make client-side adjustments to pages. All it's doing is putting everything in the UpdatePanel into a DIV an then using JS functions to manage refreshing of the DIV.
Mine as well write your own webservices tools to feed a JS function to refresh your own DIV's - that way you have ultimate control.
That link I posted gave examples of how to hijack the update panel functions and put your own spin on them...
That's where I'm about to head - gotta define a lot of metadata for controlling this so it's flexible and extensible...
-
Re: Really interesting read on update panels and web methods/services
"The customer’s complaint was that users were sometimes not noticing that part of the page had been updated with new content. His question was simple: can the folks on the ASP.NET AJAX team make UpdatePanel flicker just a little so important updates won’t be missed?"
Haha.Ok now i know i have stashed this article somewhere because i clearly remember that part :D
Anyhow i only use updatepanels to stop refreshing when i change a DropDownList index.But i thought an AsyncPostBackTrigger on the updatepanel will make an asynchronous call (?).
-
Re: Really interesting read on update panels and web methods/services
I find all this very confusing which is why I avoided so called "asp Ajax". I see constant question's on update panel this, auto extender that , can I make them do this, why isn't it working.
I think the folks at Microsoft did a great job creating asp Ajax but I think it was on the back of the ajax fad and it's just putting to much in 1 melting pot for my liking.
The purpose of JavaScript is clear. The purpose of using JavaScript to make async calls to server is clear. The purpose of web service or method are clear.
What is the purpose of asp ajax? Does it make development easier and will Microsoft continue to develop it or let it become a legacy...... obviously I'm not in awe and wonderment over asp ajax - I don't even know what that means asp ajax, ajax tool kit... what the hell are they talking about... I'm becoming irrational now.
-
Re: Really interesting read on update panels and web methods/services
this is exactly what i'm saying for months now.. right now, update panels is something i'll never use its adds to your page 400kb worth files size, it send the whole page to postback, once your ajax has become a bit more then minimal the updatepanels start to "acting up", anyways if you guys working with jQuery my advice is to add JSON into the mix since it makes passing parameters much easier.
-
Re: Really interesting read on update panels and web methods/services
Hello,
I might get shot down for saying this, but here goes....
I think part of the driving force behind ASP.Net AJAX was to provide asynchronous operations for people who aren't familiar with JavaScript, jQuery, JSON, etc. For simple cases, dropping an AJAX Update Panel onto the page, putting some controls in it, and providing a Post Back Trigger results in a simple page that doesn't require a full page post back, but can update information on the page. Behind the scenes, the AJAX controls inject all the required client side logic (and probably some it doesn't need, hence the bloat), and the user doesn't need to do any client side coding.
Now, don't get me wrong, I am not saying that this is a "good" thing, but what I am saying is that it allows the user to hit the ground running, and get familiar with the concepts. Then, as their site gets more and more complicated, they will have to start "hacking" the AJAX controls to get it to do what they want, that is when they will start looking at the alternatives.
Just my opinion...
Gary
-
Re: Really interesting read on update panels and web methods/services
Hi,
I understand what you're saying Gary, but I really think that microsoft should encourage best practice, and update panels is bad practice, for example, when i just started using ASP.NET my task was to convert our company website/backoffice from Classic ASP to .NET now, our backoffice implements some very complicated AJAX and my first thing I did was to use the updatepanel for that task. why ? cause this is what i've read from microsoft's documentations, of course i struggled to complete the task but some how I made it through but the end results was about 10 to 20 times slower then our original AJAX, the last straw was when i had to combine ajax with key strokes which cause random/un-fixable errors
then i understood something isn't right and i turned to my old buddy's (javascript / jQuery), it was hard at start since it's very different from classic asp but after a while its become much easier and i never looked back.
Finally, in my opinion the update panel idea is very cool (calling ajax and not losing your controls states) but it's un-ready technology.
I will never use it, even for the smallest page as long as it bolting and sizing my pages.
-
Re: Really interesting read on update panels and web methods/services
@brin - I've only done web forms for about two years now - and that's far from my full day - I'm still mostly SQL and winform. I gotta say the "terminology" in the web world is actually more complex the the actual "technology".
@motil -I agree completely. I'm not sure where MS ASP AJAX has a place at all.
My latest production use of an UPDATEPANEL is on a silly little attendance screen - student name and three buttons in a repeater - ABSENT, TARDY, CLEAR. UPDATEPANEL made it so easy to stop the flixer - but it's not working on ROW 1 of the REPEATER and I've not yet found out why. And I was against the wall for delivery - client has it that way.
In the long run all I really needed to do when a BUTTON was clicked was PUSH some data to the server and if a successful update occurs then change the screen a bit in that repeater row.
All of that can be done with JS, JSON and some kind of page that reads the DB update request and sends back a reply (I guess you all call that a web service?). That is 100% of the clients responbility (the browser) - SERVING up a new page "even partially" just because a visit to the DB is part of those steps is bad technology.
I see how easy it is for RAD development - but RAD can = GARBAGE half the time.
Once you have enough of your own JS functions to take care of all the async stuff you can created your own homegrown AJAX - I like it when I make my own stuff...
That silly bug of the updatepanel not working on row 1 of the repeater is what started me down this path.
-
Re: Really interesting read on update panels and web methods/services
szlamany, it one bug of many others, I'm sure it's not a direct related repeater / asp.net ajax bug,
its more general problem that cause all the other non-sensible bugs when using the updatepanel.
don't try to figure it up cause even if you'll find the fix I'm sure that soon enough you'll encounter another unexplained bug which will drive you mad for hours/days :B
again, my advice is to use jQuery which provide you easy ajax use among all its great features jQuery offers.
-
Re: Really interesting read on update panels and web methods/services
I think motil has a good point about MS publishing articles about asp ajax, sqlDatasource etc that give the idea these components are the right or best choice when they are clearly not. I think these types of RAD tools should be left to thrid party companies because .net and VS are not RAD tools. Microsoft contine to pitch the RAD aspect of their software... Business is business and RAD = more sales and I guess they are just catering to people who want to create a great website in 3 simple steps or maybe as Gary said help to get people started.
At the same time MS more than cater for my flavour of developement and keep adding stuff that I like. I think they've done some supurb stuff for web forms in .net 4.
-
Re: Really interesting read on update panels and web methods/services
Quote:
Originally Posted by
motil
Hi,
I understand what you're saying Gary, but I really think that microsoft should encourage best practice, and update panels is bad practice, for example, when i just started using ASP.NET my task was to convert our company website/backoffice from Classic ASP to .NET now, our backoffice implements some very complicated AJAX and my first thing I did was to use the updatepanel for that task. why ? cause this is what i've read from microsoft's documentations, of course i struggled to complete the task but some how I made it through but the end results was about 10 to 20 times slower then our original AJAX, the last straw was when i had to combine ajax with key strokes which cause random/un-fixable errors
then i understood something isn't right and i turned to my old buddy's (javascript / jQuery), it was hard at start since it's very different from classic asp but after a while its become much easier and i never looked back.
Finally, in my opinion the update panel idea is very cool (calling ajax and not losing your controls states) but it's un-ready technology.
I will never use it, even for the smallest page as long as it bolting and sizing my pages.
Hey,
I totally agree about encouraging best practices, however, the same could be said about the use of SqlDataSources. As some of you will know, they are one of my bones of contention. I hate to see them being used, as they are nothing more than a "Proof of Concept" control, that can get you up and running quickly, and should never be used in a Production application, instead, replaced with a true BLL, and DAL.
I believe that these controls (SqlDataSource and AJAX Controls) exist for a reason, and that reason is to allow people to get up to speed without in depth knowledge of the underlying technologies.
Gary
-
Re: Really interesting read on update panels and web methods/services
We did some experimenting with jQuery and getting a chunck of JSON data and popping it into a label.
So now I'm curious how far to take this...
We can use asp controls and do things normally, update panels and postbacks, using jQuery only to do display things or special things.
We can use asp for initial load and then manage all controls and data for the life of the page with jQuery.
We can make the controls with jQuery and manage them with jQuery.
-
Re: Really interesting read on update panels and web methods/services
its all about personal preference and technology knowledge. as i mention earlier I'm avoiding updatepanels at all cost, I already completed two very large projects which heavily use ajax (60-70 % of the pages) using only jQuery / json,
sure sometimes it means more developing work but it really pays off (in so many ways) at the end of the day.
-
Re: Really interesting read on update panels and web methods/services
Is most of the jQuery hardwired for specific events or do you create "general" functions that can maybe "self-bind" based on class names or control names or am I making things too complicated?
-
Re: Really interesting read on update panels and web methods/services
Can you use some postbacks and also jQuery - or is it all or nothing on a page.
Can you use repeaters still - what are jTemplates?
-
Re: Really interesting read on update panels and web methods/services
I'm not a javascript master so I try and keep my js/jquery/ajax usage simple and use web forms for the hard stuff. I'll use ajax (not asp ajax) for things like auto complete search boxes and getting data for forms, popup dialog etc. And purely UI stuff like photo galleries, tabs etc... I like the jquery plugins for this.
Personally I find when I mix lots of server side logic and client side logic together to try and make a web form behave like a win form I get into all sorts of trouble and it makes it really hard to come back to a page in the future and understand everything that's happening.
This is just my limitation : I'd rather make users do another step to help app managability. So to answer some of your questions : postbacks & jquery don't interfere with each other and I use jquery/ajax for specific tasks. Lastly I'm mindful that some browsers have issues with Javascript, they maybe a small % but I try to fail gracefully or even ugly as long as it still works.
-
Re: Really interesting read on update panels and web methods/services
Quote:
Originally Posted by
brin351
...and use web forms for the hard stuff...
What did you mean by web forms?
-
Re: Really interesting read on update panels and web methods/services
Quote:
What did you mean by web forms?
I mean ASP.NET. All asp.net pages are called web forms because they need the <form runat=server> tag to work. Postbacks are what enable asp.net page events, state etc, ajax requests don't have these luxuries built in.
-
Re: Really interesting read on update panels and web methods/services