How to reference a scriptmanager from HttpContext.Current.CurrentHandler?
I开发者_运维知识库 reference the current page in a class with
Page page = HttpContext.Current.CurrentHandler as Page;
I know need to reference ScriptManager1. What the syntax ?
Thanks.
Or
Page page = HttpContext.Current.CurrentHandler as Page;
if (page != null)
{
ScriptManager smgr = ScriptManager.GetCurrent(page);
}
ScriptManager sm = (ScriptManager)page.FindControl("ScriptManager1");
if(sm != null)
{
// Control found
}
精彩评论