【发布时间】:2013-02-22 19:53:49
【问题描述】:
我的母版页中有一个自定义用户控件,它将站点范围的 JavaScript 库加载到母版页的头部
像这样:
<html>
<head>
<CustomControl:MyScriptControl id="scripts" runat="server" />
</head>
<body>
<asp:ContententPlaceHolder id="pageContent" runat="server" />
</body>
</html>
我想让使用 MasterPage 的页面调用用户控件的方法 MyScriptControl 所以本质上
public partial class ChildPage: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//// Invoke Method of MasterPage's UserControl: MyScriptControl
}
}
这可能吗?或者有更好的方法吗?
【问题讨论】:
标签: c# asp.net .net master-pages