简体   繁体   中英

how to enable/disable asp.net validators on radio button click?

i have asp.net form and several radio buttons on it, they contain nested radio buttons (see picture). TextBoxes have Validators.

The question is: how to disable necessary validators when corresponding radio button is unchecked and enable them when radio is checked?

i need to do it on client side by means of javascript.

在此处输入图片说明

Do i need to group validators into validation groups?

Any help is appreciated. Thanx in advance))

if(radioButton.Checked)
{
    textBox1.required = false;
}

PS: AutoPostBack needs to be true for the radio button

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM