AJAX Made Easy - Learn AJAX



AJAX-Tips Tutorials

 
Home AJAX-Tips
 

The Error in Partial Postback ASP.Net Ajax

 

d="filecontent">

The 3.5 Version of ASP.Net features a powerful version of Ajax. When done properly, websites that runs in the latest version of ASP.Net will have full optimization support of IE7 and even its previous version, the IE6.

Other browsers will also follow suit as it could fully adapt to other browsers at the same time. That reality is very attractive to programmers if they can do Ajax right especially when using them in ASP.Net. Although there are common bugs that you often see in Ajax itself. The error in partial postback in ASP.Net is one of the growing concerns that should be aware of. This error is native of ASP.Net and could be addressed with awareness in coding and properly tweaking the platform to understand Ajax better. In fact, one of the main errors where Ajax in ASP.Net shows is during the postback action in the web pages. Full postback is ok in any given conditions but there is also an action called partial postback which could be troubling for users of the web content. Even during the partial postback, a full event for the webpage is triggered. Unfortunately, there is no half-hearted event in a web page. The effects of a full event in a partial postback will not be felt immediately but they are going to pose some problems especially when you are creating multiple pages in website which is a normal event. Be sure to look out for this type of execution since in the long run it will trigger more problems for your webpage. Since a partial postback could trigger a full page event, it’s also safe to say that the UpdatePanel will also render a full turnaround. Instead of providing new updates to the webpage it will now go back to its previous action. When you’re creating a website where users have to log in, the will always encounter errors as the previous actions and log in credentials they made doesn’t take effect once they press “backspace” even once. It’s a full turnaround of an event since the UpdatePanel is composed of four stages (Init, Load, Prerender and Unload) and all of this stages will execute a full turnaround even when only a partial is executed. Programmers usually answer this problem by protecting the UpdatePanel code with !IsPostBack state. Others employ !IsInAsyncPostBack which also give the same effect. There could be a slight problem with this page especially when it’s a real time page so both commands could pose problems as they will prevent the refresh for newer information to be update. These codes could be bypassed with a simple _EVENTTARGET in the update panel ID. Cleverly using _EVENTARGET in your coding especially in the possibility of a partial postback will remove any concerns that the webpage will actually revert to the original information. Although partial postback could be beneficial in anyway, it’s not the way Ajax works. Ajax is created to be a real time information gatherer and not a guide or logger of events. The codes that were previously mentioned should do the trick in protecting the values and information even when a partial postback is executed.

Read Next: innerHTML and Ajax – Bad Combination



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links