Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RequiredFieldValidator not working for dependent dropdown

Reply
Thread Tools

RequiredFieldValidator not working for dependent dropdown

 
 
xbound
Guest
Posts: n/a
 
      05-13-2010
I have two dropdowns: I've added a first item like "Please Select" to each
and each has it own RequiredFieldValidator control which fires if the user
does not select something. The code for the second one looks like this

<aspropDownList ID="ddl2" runat="server" AutoPostBack="true"
AppendDataBoundItems="true" ......
OnSelectedIndexChanged="ddl2_SelectedIndexChanged" >
<asp:ListItem Text="Please select" Value="0" />
</aspropDownList>
<asp:RequiredFieldValidator ID="reqddl2" runat="server"
ControlToValidate="ddl2"
Display="Dynamic" ErrorMessage="Name is required"
InitialValue="0">&larr;Required</asp:RequiredFieldValidator>


The second dropdown is populated depending on what's selected in the first
one. In the SelectedIndexChanged event of the first dropdown I've added
this statement [ ddl2.Items.Insert(0, "Please Select") ] because otherwise
that first item won't show up in the second dropdown anymore once the value
in the first dropdown has changed. The problem is that afterward the
validation control for the second dropdown no longer works.

So do I need to validate the second dropdown manually? Any insight
appreciated.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dependent dropdown lists in Struts using Hibernate Rudi Java 0 08-13-2008 04:04 PM
non-dependent vs. dependent template names puzzlecracker C++ 1 08-07-2008 07:42 AM
URGENT - RequiredFieldValidator not working after deployment - Roni Burd ASP .Net 6 07-03-2004 02:18 PM
RequiredFieldValidator and Validation Summary not working D. Shane Fowlkes ASP .Net 2 02-23-2004 04:03 PM
ASP:RequiredFieldValidator control is not working on Netscape 7. Rob ASP .Net 4 07-18-2003 05:34 PM



Advertisments