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

前端 未结 3 878
太阳男子
太阳男子 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:00

    I got it, its given in ScriptManager class itself.

    System.Web.UI.ScriptManager.GetCurrent(this.Page);
    
    0 讨论(0)
  • 2020-12-31 03:17

    Have you checked out this:

    Working with ASP.NET Master Pages Programmatically
    http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx

    0 讨论(0)
  • 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
    
    0 讨论(0)
提交回复
热议问题