使用FindControl出现未将对象引用设置到对象的实例 错误的解决办法
经过一番搜索,在forums.asp.net中找到了答案,以下引用的是bitmask的说法:
...becasue the Content controls themselves dissapear after the master page rearranges the page. You can use the ContentPlaceHolders, or the <form> on the MasterPage if there are no INamingContainers between the form and the control you need.
所以以上的代码应该改成:
TextBox tb = (TextBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("TextBox1");
资料引用:http://www.knowsky.com/339938.html