Link to home
Start Free TrialLog in
Avatar of tag_k
tag_k

asked on

required field validator in .net1.1

hi
i have a web form,in which user can select a radiobutton and few controls will be visible on the form. i have 3 such radio buttons and have used validators for diffent controls.now if user is selecting first radi button and submiting without text,required field validator is showing error but when user selects another radio button and submitting the form,required field validator which belongs to the first radio button is showing error.
how to fix this?
using .net1.1/c#
thank you
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi tag_k;

You state that, "if user is selecting first radi button and submiting without text,required field validator is showing error ", What is the ControlToValidate property of the RequiredFieldValidatator set to. It can not be set to a radio button.

Fernando
Avatar of tag_k
tag_k

ASKER

Hi Fernando,
Control to validate is set to textbox which is made visible when radiobutton1 is selected.
when user tries to subit form without any text in textbox for the first time,its showing error which is good.but when user submitts the form again and again without text in textboxes,then problem is raised.
it shows error message for the controls which are not visible on the form at that moment(i.e controls under radio button 2 and 3).
Avatar of tag_k

ASKER

i even have controls(textboxes and buttons) under radiobutton 2 and 3,these textboxes have required field valdator.
ex:
i have 2 radio buttons add and delete.
when i select add,2 controls appear on the form.textbox1 and button1.i hit button1 without any text in textbox1,its shows required field validator.now i select delete radiobutton,textbox2 and button2 are visible on form and i hit button with out text in textbox,it shows required field.

but when again i select radiobutton 1 and hit button1 without text in textbox1,i see 2required field error messages(one from textbox1,which is visble on form and second from textbox2 ,which is not visible on form).
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial