在 ASP.NET 中,如何找到嵌套在 DetailsView 中的 TextBox 的控件 ID,然后再嵌套在 AJAX UpdatePanel 控件中?
在 ASP.NET 中,如何找到嵌套在 DetailsView 中的 TextBox 的控件 ID,然后再嵌套在 AJAX UpdatePanel 控件中?
层次结构是:UpdatePanel1 -> dvContentDetail(详细信息视图控件)-> TextBox2
我尝试过类似以下的操作,但只是说找不到该对象:
UpdatePanel1.FindControl("dvContentDetail").FindControl("TextBox2").ClientID
n ASP.NET how do I find the Control ID of a TextBox that is nested within a DetailsView which is then nested in an AJAX UpdatePanel control ?
The heirachy is: UpdatePanel1 -> dvContentDetail (DetailsView Control) -> TextBox2
I have tried something like the following but just says that the object isn't found:
UpdatePanel1.FindControl("dvContentDetail").FindControl("TextBox2").ClientID
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不需要从updatepanel中找到控件,因为这些控件直接可用,所以你的代码将是这样的......
There is no need to find control from updatepanel, because these controls directly available, so you code will be like this...
您可以尝试类似下面的代码。 但是,如果您知道层次结构不会发生变化,那么最好执行一系列“FindControl”调用。 要发现正确的层次结构,请调试应用程序并搜索控制层次结构。
You could try something like the code below. But if you know the Hierarchy is not going to change it would be better to do a series of "FindControl" calls. To discover the correct hierarchy, Debug the app and search through the Control Hierarchy.