In a project master pages do not have code behind files; and in content page I need to read user control's properties which is inside master page. Can you please advice how it can be done.
在内容页面上尝试一下
YourControl YourControlObj = this.Master.FindControl("YourControl") as YourControl;
In Master Page -
<asp:TextBox Id="txt" />
In content page -
TextBox t = this.Master.FindControl("txt") as TextBox;
t.Text = "Some Value";
看看是否有帮助
Literal mpLiteral = (Literal) Master.FindControl("masterPageLiteralControlID");
Do like this
In Master page
<uc1:MyWebUserControl ID="myCtl" runat="server" ClientIDMode="Static" />
In content page (in code behind )
MyWebUserControl myWCtl = this.Master.FindControl("myCtl") as MyWebUserControl;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.