java script disable control in

Posted by Gopal_nivas under ASP.NET on 10/19/2010 | Points: 10 | Views : 2230 | Status : [Member] | Replies : 2

i have two radio buttons.

for radio button1 i have placed a file upload control. and radio button2 another file upload control is placed..

if i select radiobutton1 then file upload2 should be disabled and if i selects radio button 2 file upload1 should be disabled..

and also i want validate the enabled file upload control.(i.e to place required field validator)and the disabled file upload control should not be validated..

how to do this in java script.

need ur suggestions with examples..



Posted by: Varshavmane on: 10/19/2010 [Member] Starter | Points: 25


Check this link:

Also you can do something like this:
In code behind:

in javascript function you can find the file upload control like this:
var fileupload = document.getElementById('<%= fileupload1.ClientID %>');

and disable the way you want.

For question 2 set CauseValidation for the control so it wont fire the required field Validator.
Let me know if you have any issues with it.
Hope that helps.

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: SurajRane on: 10/20/2010 [Member] Starter | Points: 25

You want to do it client side right.

you can disable fileupload control using javascript as mentioned "Varshavmane"

and to disable validations you need to use below code

Var requiredValidator = document.getElementById('<%=RequiredFieldValidator1.ClientID %>');

ValidatorEnable(requiredValidator , false);

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response