I know about Always vs. Conditional, I just need to know exactly which update panel's data needs to be refreshed (not taken from app tier cache) on the serverside.
views:
9answers:
1
A:
Here is a way that I use:
public static bool IsUpdatePanelInRendering(Page page, UpdatePanel panel)
{
if (false == page.IsPostBack)
{
return true;
}
else
{
ScriptManager sm = ScriptManager.GetCurrent(page);
if (sm != null
&& sm.IsInAsyncPostBack
&& HttpContext.Current != null
&& HttpContext.Current.Request != null
&& HttpContext.Current.Request.Form != null)
{
string smFormValue = HttpContext.Current.Request.Form[sm.UniqueID];
if (!string.IsNullOrEmpty(smFormValue))
{
string[] uIDs = smFormValue.Split("|".ToCharArray());
if (uIDs.Length == 2)
{
if (!uIDs[0].Equals(panel.UniqueID, StringComparison.InvariantCultureIgnoreCase))
{
return false;
}
}
}
}
return true;
}
}
Aristos
2010-09-16 16:05:21