这儿有微软的一个例子
http://msdn2.microsoft.com/zh-cn/library/xxwa0ff0(VS.80).aspx 希望能对你有所帮助。
母板页是2005 新引进的概念吧,
我这儿现在还用2003呢,看样也要装个05学学了!!
void Page_Load()
{
// Gets a reference to a TextBox control inside
// a ContentPlaceHolder
ContentPlaceHolder mpContentPlaceHolder;
TextBox mpTextBox;
mpContentPlaceHolder =
(ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
if(mpContentPlaceHolder != null)
{
mpTextBox =
(TextBox) mpContentPlaceHolder.FindControl("TextBox1");
if(mpTextBox != null)
{
mpTextBox.Text = "TextBox found!";
}
}
// Gets a reference to a Label control that not in
// a ContentPlaceHolder
Label mpLabel = (Label) Master.FindControl("masterPageLabel");
if(mpLabel != null)
{
Label1.Text = "Master page label = " + mpLabel.Text;
}
}
[此贴子已经被作者于2007-11-18 15:26:19编辑过]