While developing ASP.NET 2.0 application with AJAX many times we came across scenarios when we had to know if the call made to the server is complete postback or partial postback (using update panel)
In ASP.NET 2.0 a property called IsCallBack
was exposed for the user to validate this. However it was found that this property is always set to false when used along with ASP.NET AJAX extensions.
In case a partial postback is done using update panel you will find the IsPostBack
is always true and IsCallback
is always false.
Hence to check whether the page was called using update panel or it was a complete postback we can use the below code.
if (ScriptManager.GetCurrent(this).IsInAsyncPostBack)
{
}
The ScriptManager.GetCurrent(this).IsInAsyncPostBack
returns true
when the server side code is invoked using a update panel.
Where this
is the instance of the page to which the postback was made.
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.
The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.