如何使验证控件可见 [英] How to make the validation control to visible true

查看:123
本文介绍了如何使验证控件可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序中,我使用单选按钮列表,其中两个列表项分别为是"和否".
如果用户单击是",则我正在启用该文本​​框,对于该文本框,我已将requiredfield验证和comparevalidation控件设置为可见false为默认值.
当用户单击是"单选按钮时,我要启用文本框并使验证控件在Javascript中显示为true.谁能帮我解决这个问题.
这是代码:

Hi,

In my application I am using the radiobutton list with two list item as Yes and No.
If the user clicks on yes I am enabling the textbox, for this text box I have set the requiredfield validation and comparevalidation controls with visible false as default.
When the user clicks the Yes radiobutton I want to enable the textbox and make the validation controls as visible true in Javascript. Can anyone help me to solve this problem.
Here is the code:

function EMD_OnClick(val) 
{
 if (val == 'Y') 
 {
    document.getElementById("<%=drpEMDCurrency.ClientID %>").disabled = false;
    document.getElementById("<%=drpEMDCurrency.ClientID %>").focus();
    document.getElementById("<%=txtEMDValue.ClientID %>").disabled = false;
    document.getElementById("<%=rqdEMD.ClientID %>").style.display = "";
    document.getElementById("<%=cmpEMDValue.ClientID %>").style.display = "";
 }
 else if (val == 'N') 
 {
    document.getElementById("<%=drpEMDCurrency.ClientID %>").disabled = true;
    document.getElementById("<%=txtEMDValue.ClientID %>").disabled = true;
    document.getElementById("<%=rqdEMD.ClientID %>").style.display = "none";
    document.getElementById("<%=cmpEMDValue.ClientID %>").style.display = "none";
 }
}



在此先感谢



Thanks in Advance

推荐答案

尝试以下操作:

http://forums.asp.net/t/1559695.aspx/1 [ ^ ]
从Javascript调用验证程序控件.
Try following:

http://forums.asp.net/t/1559695.aspx/1[^]
Calling validator controls from Javascript.


这篇关于如何使验证控件可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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