如何访问母版页上的页面控件 [英] how to access page control at master page
本文介绍了如何访问母版页上的页面控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何访问母版页上的页面控件
我在页面上有一个标签,我想在母版页上访问此标签,我该怎么做
page_name = index.aspx
masterpage = master.mater
how to access page control at master page
i have one label at page i want access this label at masterpage what i do
page_name=index.aspx
masterpage=master.mater
推荐答案
试试这个
Hi ,
Try this
protected void Page_Load(object sender, EventArgs e)
{
Label lbl = (Label)Master.FindControl("ContentPlaceHolder1").FindControl("Label1");
string test = lbl.Text;
}
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Label ID="Label1" runat="server" Text="yyyyyyyy"></asp:Label>
</asp:Content>
最好的问候
M.Mitwalli
Best Regards
M.Mitwalli
我认为您正在寻找这个..!
单击此处获取解决方案.. [
I think you are searching for this..!
Click here for your solution..![^]
一旦看到此
http://www.dotnetstuff.co.cc/2012/01/finding-page-control-in-master-master.html [
once see this
http://www.dotnetstuff.co.cc/2012/01/finding-page-control-in-master-page.html[^]
这篇关于如何访问母版页上的页面控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文