获取母版页控制

发布于 2024-10-09 11:24:20 字数 155 浏览 0 评论 0原文

我正在寻找一种访问我的页面控件的方法。

我发现这个函数可以让我输入我的控件的ID和“根控件” 然后它会搜索“根控件”的子控件,直到找到我的控件 ID。

但问题是我的控件嵌套在一个表中,而该表又嵌套在我的母版页中的一个页面中。

母版页的根控件是什么?

I'm looking for a way to access my page's controls.

I found this function that allows me to enter the ID of my control and the "root control"
and than it searches the children of the "root control" untill it finds my control id.

But the problem is that my control is nested in a table and the table is nested in a page in my master page.

whats the root control for the master page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小…红帽 2024-10-16 11:24:20

您可以使用Master 内容页属性来获取母版页,然后
FindControl 向下钻取,直到获得您正在寻找的控件(或者您可以使用已有的功能)。

请参阅 MSDN 上的操作方法。

You can use the Master property of your content page to get the master page, then
FindControl to drill down till you get the control you are looking for (or you can use the function you already have).

See this howto on MSDN.

寄居者 2024-10-16 11:24:20

尝试

(this.Page.MasterPage as MyMasterPage).SomeMasterPageMethodOrProperty

Try

(this.Page.MasterPage as MyMasterPage).SomeMasterPageMethodOrProperty

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文