If masterPage is used in. net 2.0, you cannot use FindControl as before. You need to use the following method:
First find ContentPlaceHolder, and then find the control you are looking for in this ContentPlaceHolder
1
2 // ContentPlaceHolder ID in MasterPage
3 string masterPageContentPlaceHolderID = "";
4 // ID of the control to be found in masterPageContentPlaceHolderID
5 string m_strSetDataToID = "";
6 // For example, search for TextBox
7 TextBox textBoxFind = (TextBox) this. Page. Master. FindControl (masterPageContentPlaceHolderID). FindControl (m_strSetDataToID );
Http://www.cnblogs.com/forward/articles/masterpage.html
ContentPlaceHolder mpContentPlaceHolder;
Label mpTextBox;
MpContentPlaceHolder =
(ContentPlaceHolder) Master. FindControl ("home ");
If (mpContentPlaceHolder! = Null)
{
MpTextBox = (Label) mpContentPlaceHolder. FindControl ("ctl00_member_name ");
If (mpTextBox! = Null)
{
MpTextBox. Text = "TextBox found! ";
}
Else
{
Response. Write ("Label fdfd ");
}
}
Else
{
Response. Write ("ContentPlaceHolder fdfd ");
}
There are still problems.