[英]How to get the ScriptManager of Master Page into Child page's code behind c# (.cs) file
Following is the web site environment I created: 以下是我创建的网站环境:
Now I want to access that Master page's Script Manager to create a User Control dynamically in my code behind (C#) file. 现在我想访问Master页面的脚本管理器,在我的代码隐藏(C#)文件中动态创建用户控件。
How can I access Script Manager placed on master page to my child page. 如何访问放置在母版页上的脚本管理器到我的子页面。
我得到了它,它在ScriptManager类本身中给出。
System.Web.UI.ScriptManager.GetCurrent(this.Page);
Not sure what exactly you want here... you want to access the script manager of your master page or just the masterpage
? 不知道你想在这里什么......你要访问您的母版页的脚本管理器或只是
masterpage
?
You can access the master page by Page.Master
in code behind 您可以通过
Page.Master
的代码中的Page.Master
访问母版页
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
Have you checked out this: 你看过这个:
Working with ASP.NET Master Pages Programmatically 以编程方式使用ASP.NET母版页
http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.