在页面中使用Master.Page指向什么?
在一个套用母版的页面中使用protected void Page_LoadComplete(object sender, EventArgs e)
{
Label lbl = Master.Page.FindControl("lblGuid") as Label;
lbl = Master.Page.FindControl("lblPageGuid") as Label;
}
lblGuid是母版的Labe,lblPageGuid是本页的Label,执行上面两句后lbl 都是空,我知道Master.FindControl是找母版的控件,那么Master.Page.FindControl这个是找哪儿的? --------------------编程问答-------------------- TextBox txt1=this.Master.FindControl("MainContent").FindControl("TextBox1") as TextBox1
this的第一个对象找到的应该是MasterPage中的控件,而不是aspx中的控件。因为Aspx其实是把内容放在其中一个Content上的子控件上,所以aspx页面只能是this的一个子控件。
补充:.NET技术 , ASP.NET