2015年6月3日 星期三

ASP.NET Access Master Page Control

Access Master Page Control



Get Master1-TextBox1
C#:
MasterPage master1 = Master.Master;
TextBox textbox1 = master1.FindControl("TextBox1") as TextBox;

Get Master2-TextBox2
C#:
ContentPlaceHolder mpContentPlaceHolder = (ContentPlaceHolder)master1.FindControl("ContentPlaceHolder1");
if (mpContentPlaceHolder != null)
{
    TextBox textbox2 = mpContentPlaceHolder.FindControl("TextBox2") as TextBox;
}

沒有留言:

張貼留言