在aspx页面中找到控件 [英] Find Control in an aspx page

查看:98
本文介绍了在aspx页面中找到控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在主页面"Master2.master"中保存的aspx页面"Default.aspx"中找到控件. Master2.master页面保存在另一个Master"Master1.master"页面内,我如何通过代码在Default.aspx页面中获取控件?任何机构都不知道如何实现它吗?

i want to find the controls in an aspx page "Default.aspx" which is kept in a master page "Master2.master". The Master2.master page is kept inside another master page "Master1.master" how can i get the controls in Default.aspx page through code Do any body have any idea how to implement that?

推荐答案

您可以使用 Page.Master属性,例如:

TextBox TextBox1 = Page.Master.Controls.FindControl("TextBox1");

请参阅:如何:参考ASP.NET母版页内容

希望对您有用.
-------------------------------------------------- ----------------
签名:卡萨斯在苏扎诺河畔
You can use the Page.Master property, like this:

TextBox TextBox1 = Page.Master.Controls.FindControl("TextBox1");

See to: How to: Reference ASP.NET Master Page Content

I hope it is useful.
------------------------------------------------------------------
Signature: Casas a venda em Suzano


尝试一下,
Try This,
Master.Master.FindControl("controlId")


这篇关于在aspx页面中找到控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆