How to get the ScriptManager of Master Page into Child page's code behind c# (.cs) file

前端 未结 3 894
太阳男子
太阳男子 2020-12-31 02:24

Following is the web site environment I created:

  1. I have a Master page.
  2. I have created a Child page from it.
  3. I have placed Script Manager on
3条回答
  •  渐次进展
    2020-12-31 03:27

    Not sure what exactly you want here... you want to access the script manager of your master page or just the masterpage?

    You can access the master page by Page.Master in code behind

    Or

    using System.Web.UI;
    ScriptManager ScriptManager1 = (ScriptManager)Page.Master.FindControl("ScriptManager1") 
    // to access the script manager of master page
    

    or

    Page.Master.Controls.Add(Your UserControl object) 
    // to add the user control in your master page
    

提交回复
热议问题