Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

required field validator in .net1.1

Posted on 2007-12-04
4
Medium Priority
?
545 Views
Last Modified: 2013-12-16
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
0
Comment
Question by:tag_k
  • 2
  • 2
4 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 20411628
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
0
 

Author Comment

by:tag_k
ID: 20411869
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).
0
 

Author Comment

by:tag_k
ID: 20412100
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).
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 20412653
Hi tag_k;

This is what is happening. Because you hide or make Visible property to false does not mean that the RequiredFieldValidayor stops working. When you make the TextBox Visiable property to false you need to make the RequiredFieldValidator.Enabled = false so that it will not validate a inactive control.

Fernando
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question