[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Validate DropDownList with CascadingDropdown

Posted on 2010-09-08
5
Medium Priority
?
1,205 Views
Last Modified: 2013-12-13
I can't get this to validate. The same works for my regular DDLs without cascadingdropdown extenders. But this one will not work. I tried to set controltovalidate="CascLessonDay" but it is not recognized at run time as a control that can be validated.

the other thing is, is that this is within a createNewUser wizard control, and it is hard to access the next button for me, so I dont' know how to validate this ddl to make sure that the user selects something.

Thank you.
<asp:DropDownList ID="LessonDay" runat="server" >
                    </asp:DropDownList>

<asp:CascadingDropDown ID="CascLessonDay" ParentControlID="Teacher1" Category="day2"
       PromptText="Select Day"
        ServiceMethod="GetDay"
         ServicePath="~/Teachers.asmx"
          TargetControlID="LessonDay" runat="server">
                </asp:CascadingDropDown>

       <asp:CompareValidator ID="CompareValidator1" ControlToValidate="LessonDay" Operator="notEqual" ValueToCompare="0" ErrorMessage="Please select day" runat="server">*</asp:CompareValidator>

Open in new window

0
Comment
Question by:mlg101
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:bureshd
ID: 33633609
use a Required Field Validator instead.

<asp:requiredfieldvalidator ID="ReqVal" runat="server"   errormessage="RequiredFieldValidator" InitialValue="0" ControlToValidate="LessonDay" ErrorMessage="Please select day"></asp:requiredfieldvalidator>

Open in new window

0
 
LVL 1

Author Comment

by:mlg101
ID: 33633691
That does not work either. When I click the button, it just goes to the next page without any selection
0
 
LVL 2

Expert Comment

by:bureshd
ID: 33633714
set the button and validator with the same validator group....and make sure the button cause validation
<asp:requiredfieldvalidator ID="ReqVal" runat="server"   errormessage="RequiredFieldValidator" InitialValue="0" ControlToValidate="LessonDay" ErrorMessage="Please select day" ValidationGroup="check"></asp:requiredfieldvalidator>

Open in new window

0
 
LVL 1

Author Comment

by:mlg101
ID: 33633729
I can't find the "next" button in the createuserwizard...where is it?
0
 
LVL 15

Accepted Solution

by:
rajeeshmca earned 2000 total points
ID: 33633828
Hi mlg101,

Add the PromptValue property for the Cascading dropdown control...

<asp:CascadingDropDown ID="CascLessonDay" ParentControlID="Teacher1" Category="day2"
                PromptText="Select Day" PromptValue="0" ServiceMethod="GetDay" ServicePath="~/Teachers.asmx"
                TargetControlID="LessonDay" runat="server">
            </asp:CascadingDropDown>
            <asp:CompareValidator ID="CompareValidator1" ControlToValidate="LessonDay" Operator="NotEqual"
                ValueToCompare="0" ErrorMessage="Please select day" runat="server" >*</asp:CompareValidator>

0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
Viewers will learn how to use the Hootsuite Dashboard.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

656 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