asp.net requiredfieldvalidator 依赖于标签文本
我在页面上有两个控件,标签和下拉列表。 我在下拉列表中有一个 requiredfieldvalidator,但我想要实现的是,如果标签有一些文本,则不需要从下拉列表中进行选择。 如果标签没有任何内容,则下拉列表 requiredfieldvalidator 应该可以工作。 知道我该如何解决这个问题吗? 提前致谢拉齐亚莱
I have two controls on a page, label and dropdownlist.
I have a requiredfieldvalidator on the dropdownlist, but what I want to achieve is that if the label has some text than there is no need for selection from the dropdownlist.
If the label doesn't have any content than the dropdownlist requiredfieldvalidator should work.
Any idea how I can solve this?
Thanks in advance Laziale
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果文本随着你的 C Sharp 代码而改变,那么你可以这样做。
如果客户端发生变化,最好编写一些自定义 JavaScript 代码,并在检查条件后进行验证。
希望有帮助。
If the text is changing with your C Sharp code, then you can do like this.
If it is changing in client side, better to write some custom javascript code and do the validation after checking the condition.
Hope it helps.