使用"的FindControl"基地页 [英] Using "FindControl" on a base page

查看:102
本文介绍了使用"的FindControl"基地页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面,Default.aspx的继承形式BasePage.cs。

My page, Default.aspx inherits form BasePage.cs.

在基本页面我试图找到控制Label1的,实际上是在Default.aspx的。

In the base page I am trying to find the control Label1 that is actually in Default.aspx.

var labelControl = (TextBox)Page.FindControl("Label1");

不过,这总是回来空。我可以通过基本页面发现其他页面的控件?

However, this is always coming back as null. Can I find controls of other pages through the base page?

推荐答案

的FindControl不是递归(ASP.NET团队还没有实现它性能方面的原因)。

FindControl is not recursive (ASP.NET team haven't implemented it for performance reasons).

这篇关于使用"的FindControl"基地页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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