必填字段验证器可见false

必填字段验证器可见false

本文介绍了必填字段验证器可见false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..有谁能帮助我.
我对必填字段验证器有疑问.实际上,我有一份注册表,并且有一些字段,例如(全名,姓氏,d.o.b等).
有一个复选框,当我选中该复选框时,我想要的是我在全名或姓氏可见性上应用的必需验证器将被隐藏.我的意思是行不通.其余所有必需的字段验证器将起作用.请帮助我..

hi.. is there any one who can help me.
i have a problem with required field validator. actually i have a registration form and there are some fields like(full name. last name , d.o.b, etc).
there is a check box and what i want that when i check that checkbox the required validator that i have applied on full name or last name visiblity will be hidden. i mean will not work. and rest of all required field validator will work.pls help me out..

推荐答案


protected void checbox1_CheckChanged(object sender, EventArgs e)
{
    if(checkbox1.Checked)
    {
        //Suppose your first name RequiredFieldValidator's id is RequiredFieldValidator1
        //And your last name RequiredFieldValidator's id is RequiredFieldValidator2
        RequiredFieldValidator1.Visible = false;
        RequiredFieldValidator2.Visible = false;
    }
    else
    {
        RequiredFieldValidator1.Visible = false;
        RequiredFieldValidator2.Visible = false;
    }
}





--Amit





--Amit



这篇关于必填字段验证器可见false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:04