2015年6月3日 星期三

ASP.NET Access Master Page Control

Access Master Page Control



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

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

沒有留言:

張貼留言