TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Gary King
NA
83
209.3k
How to create CustomValidator in code behind
Oct 11 2010 10:49 AM
If I have a basic page with 2 dropdownlists (
myDDL1
and
myDDL2
).
The Items for the lists are:
myDDL1: "", "
Red
" and "
Blue
"
myDDL2: "", "
Sky
" and "
Royal
"
If the user selects "
Blue
", then they should also select a value from
myDDL2
(if a value is not selected, then display "Please select a value" next to
myDDL2
.
If the user selects "
Red
", then I dont need any validation on
myDDL2
(or maybe I should validate that the user has not selected a value from
myDDL2
?)
I think that what I need is a custom validator which will check if
myDDL2
selected text is "Blue" and that a value has been selected on
myDDL2
, but I'm not having any luck with coding.
The aspx does
not
have a custom validator - instead, I would like it to be created within the aspx.cs Page_Load event. Also, I would prefer this to be a server-side validation (although I would consider using client-side).
Reply
Answers (
7
)
About Navigation Between User Controls
Filling a template with information.