在ASP.NET 2.0 中如果使用了masterPage,则不能像未使用母版页时那样使用 FindControl,则需要使用先找到ContentPlaceHolder及其ID,然后再找在这个ContentPlaceHolder中的你要找的控件,方法如下:

以Label控件为例:

Label lbl = (Label)this.Page.Master.FindControl(母版页中ContentPlaceHolder的ID).FindControl(你要查找的控件ID);

相关文章:

  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2021-07-22
  • 2022-12-23
  • 2022-01-25
猜你喜欢
  • 2021-07-27
  • 2021-09-10
  • 2022-01-07
  • 2021-06-29
  • 2022-12-23
  • 2021-06-16
相关资源
相似解决方案