I Have a common method that displays alert message using page.clientScript. But later on i added update panel. Now this piece of code is not working. So I need to call there scriptmanager, but i get some error message that it is accessible there. Below is my ShowMessage method of common.cs file
private static void ShowMessage(Page currentPage, string message)
{
var sb = new StringBuilder();
sb.Append("alert('");
sb.Append(message);
sb.Append("');");
currentPage.ClientScript.RegisterClientScriptBlock(typeof(Common), "showalert", sb.ToString(), true);
}
So how do I use this method under update panel
Make use of : ScriptManager.RegisterClientScriptBlock Method
ScriptManager.RegisterClientScriptBlock(
this,
typeof(Page),
"TScript",
script,
true);