tags:

views:

9

answers:

1

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.

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;
    }
}

Ref: http://forums.asp.net/p/1385862/2946216.aspx

Aristos