如何从ASP.NET中的母版页访问内容页面控件
发布时间:2020-12-15 23:31:43 所属栏目: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.SelectedVal
从内容页面访问主页面控件非常简单
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; } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 使用ASP.NET MVC3进行客户端模型级或表单级
- asp.net – 如何获得Url.Action使用正确的端口号?
- asp.net – ASP Core,Identity Server 4和Angular 2中的外部
- asp.net – 当服务器运行3.5时,以.NET 3.5内置到目标4.0的站
- asp.net – RadGrid自定义过滤器
- asp.net – 渗透测试人员说.ASPXAUTH cookie是不安全的并且
- asp.net-mvc – MVC 3.0编辑可变长度列表并使用PRG模式
- 有人可以向我介绍asp.net路由语法吗?
- 在运行时期间在ASP.NET Web API中控制[JsonIgnore]
- ASP.NET元:resourcekey
推荐文章
站长推荐
- ASP.NET Web API – 实体框架 – .Include上的50
- asp.net-web-api2 – 创建新的IHttpActionResult
- asp.net-mvc-3 – 从HttpContext.Current访问Tem
- ASP.NET 路由实现页面静态化(附在线Demo和Source
- asp.net – 当passwordFormat = Encrypted和decr
- asp.net-mvc – 如何在Visual Studio 2015中快速
- asp.net – 根据角色重定向到其他页面
- asp.net – 如何限制指定文件类型的下载
- 何时在ASP.NET上选择LAMP?
- asp.net-core – 尝试激活RegisterModel时无法解
热点阅读