Solved

required field validator in .net1.1

Posted on 2007-12-04
4
492 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 62

Expert Comment

by:Fernando Soto
Comment Utility
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
Comment Utility
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
Comment Utility
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 62

Accepted Solution

by:
Fernando Soto earned 500 total points
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now