17 September 2008

When you have update panel in your web page, You wanted to update page, Actually there will be same page life cycle, and also Page_Load event, It means that suppose you have some code in Page_Load event to bind Grid which is not there in UpdatePanel, Normally it will go to rebind data!

So, the question is how could we know different between normal postback and post back via update panel?

There is a property in "ScriptManager" control to get this different named "IsInAsyncPostBack"


protected void Page_Load(object sender, EventArgs e)
{
if (!ScriptManager1.IsInAsyncPostBack)
{
///Page Regular code
}
else
{
///Code Only for controls inside Update Pagens
}
}

0 comments :

Post a Comment