I have a common function(custom control’s function) that is called from various webpages in the application.
In the common function,I call a javascript like this(Sample Code)-
public void ShowMessage(string strMessage)
{
string s=String.Empty;
s="<script type='text/javascript'>\n";
s = s + "alert('+strMessage+');";
s = s + "</script>";
Page.ClientScript.RegisterStartupScript(typeof(Page), this.ClientID, s);
}
When I called this function from a page that is using UpdatePanel,Page.RegisterStartUpScript didn’t work.
So, I have to use ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), this.ClientID, s, false);
Now,I have to pass one more parameter to determine the function was called from UpdatePanel.
Like this-
public void ShowMessage(string strMessage,bool isFromUpdatePanel){..}
My Question is ,In the common function,can I know whether the function is called from UpdatePanel or not(without using parameter)?
I found an answer and I will use this(got from Here)-
If there is a better solution,please teach me.