asp.net 更新面板和验证器不工作

发布于 2024-08-14 05:59:42 字数 175 浏览 1 评论 0原文

我创建了 UserControl,其中包含一个文本框和该文本框的限制长度验证器。

我通过 UpdatePanel 动态地将用户控件添加到我的父 WebForm 中。问题是验证器无法工作。它只是不会触发。

我在 .net 3.5 上工作。

有谁知道发生了什么以及我怎样才能使这个验证器工作。

I have created UserControl that contains a textbox and a restricted length validator for that textbox.

I'm adding user controls dynamically via UpdatePanel to my Parent WebForm. And the problem is that Validator just won't work. It just won't trigger.

I work on .net 3.5.

Does anyone have any clue what is happening and how can I make this validator work.

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

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

发布评论

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

评论(3

内心激荡 2024-08-21 05:59:42

我在详细信息视图中遇到类似的问题 - > updatepanel - >验证器

检查 线程了解详细信息

在客户端单击我已使用 javascript 函数启用验证器

ValidatorEnable(document.getElementById('<%=rfv.ClientID%>'), true);

I have face similar problem and my validator in the detailsview-->updatepanel-->Validator

Check this thread for details

On the Client Click I have enable validator using javascript function

ValidatorEnable(document.getElementById('<%=rfv.ClientID%>'), true);
病女 2024-08-21 05:59:42

我也遇到过这样的问题。我使用的是.Net 3.0 和 VS2005。我参考了这个问题讨论和解决方案< /a> 可以解决我的问题。您也可以参考相同的内容。

I too faced such an issue. I was using .Net 3.0 and VS2005. I referred to this problem discussion and the solution and could solve my issue. You too can refer the same.

自此以后,行同陌路 2024-08-21 05:59:42

据我了解,您无法动态添加控件,因为这会改变页面结构并且 .net 会变得混乱。相反,您必须让所有控件加载“onLoad”,然后只需更改其可见标志即可根据需要显示或隐藏它们。

这样 .net 就可以跟踪它们并且很高兴。

As far as I understand it you can't add controls dynamically as this changes the page structure and .net gets confused. Instead you have to have all controls loaded "onLoad" and then simply change their visible flag to show or hide them as needed.

This way .net can keep track of them all and is happy.

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