Solved

required field validator in .net1.1

Posted on 2007-12-04
4
519 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 63

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 63

Accepted Solution

by:
Fernando Soto earned 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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 use and create keystrokes in Netbeans IDE 8.0 for Windows.

733 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