如何从ASP.NET中的母版页访问内容页面控件

内容页面访问主页面控件非常简单
protected void Page_Load(object sender,EventArgs e)
{
    // content page load event
    DropDownList thisDropDown = this.Master.FindControl("someDropDown") as DropDownList;
    userLabel.Text = thisDropDown.SelectedValue;
}

但是如何从主页面访问内容页面的控件.假设内容页面中有一个文本框,在母版页中有一个按钮.我想要的是,当我点击母版页按钮时,我想在主页面标签内容页面中显示文本框的文本.怎么实现呢请帮我代码示例.谢谢.

解决方法

在主页按钮单击事件应访问页面内容: –
protected void Button1_Click(object sender,EventArgs e)
{
    TextBox TextBox1 = (TextBox)ContentPlaceHolder1.FindControl("TextBox1");
    if (TextBox1 != null)
    {
        Label1.Text = TextBox1.Text;
    }
}

相关文章

这篇文章主要讲解了“WPF如何实现带筛选功能的DataGrid”,文...
本篇内容介绍了“基于WPF如何实现3D画廊动画效果”的有关知识...
Some samples are below for ASP.Net web form controls:(fr...
问题描述: 对于未定义为 System.String 的列,唯一有效的值...
最近用到了CalendarExtender,结果不知道为什么发生了错位,...
ASP.NET 2.0 page lifecyle ASP.NET 2.0 event sequence cha...