Reputation: 38190
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.
Upvotes: 1
Views: 1047
Reputation: 7941
Or
Page page = HttpContext.Current.CurrentHandler as Page;
if (page != null)
{
ScriptManager smgr = ScriptManager.GetCurrent(page);
}
Upvotes: 6
Reputation: 7539
ScriptManager sm = (ScriptManager)page.FindControl("ScriptManager1");
if(sm != null)
{
// Control found
}
Upvotes: 3