文本框上的动态验证 [英] Dynamic validation on textbox

查看:81
本文介绍了文本框上的动态验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

再次请我摆脱这种情况.

我有一个下拉列表,该列表是验证所必需的;如果选择了下拉列表,则是可见的文本.我希望如果用户选择否",则在选择是"时将强制使用它,这不是强制性的.
请帮助我该怎么做.

hi guys,

pls again me out of this situation.

i have an dropdown list which is mandatory by validation and If dropdown list selected yes then text is visible. i want it will mandatory on selected yes if user select no then it is not mandatory.

pls help how can i do this.

推荐答案

在dropdownlist控件的textchange事件中,检查dropdownlist选定的值是否为yes,如果是,则显示文本框,否则不显示它.
然后将文本框验证为
如果(txt1.Visible == true&& txt1.Text ==") –您可以像这样进行验证..

或者您也可以验证,
if(dropdownlist.selectvalue ==是"&& txt1.Text ==")
on the textchange event of dropdownlist control, check whether the dropdownlist selected value is yes, if so display the textbox else dont display it.
Then validate the textbox as,
if (txt1.Visible == true && txt1.Text == "") -- you can validate like this..

or you can validate like,
if(dropdownlist.selectvalue == "Yes" && txt1.Text == "")


这篇关于文本框上的动态验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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