我试图通过在上一页上找到一个控件(文本框)来将文本分配给一个标签。控件已准确找到,但无法分配文本。Intellisense 不显示“文本”属性。如何获取文本?
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Control ctContent = this.PreviousPage.Master.FindControl("MainContent");
Control ct = (TextBox) ctContent.FindControl("TextBox1");
//TextBox t = (TextBox) Page.PreviousPage.Master.FindControl("TextBox1");
Label1.Text = String.Format("This is what you wrote there: {0}",ct.??????);
}
}