Validate a ListBox using validators inside a usercontrol

F

Fernando Lopes

Hi.
I have a page with a usercontrol.
In this UC, I have two ListBoxes and two buttons. When i click in one
button, i get the selected item in the listbox.
How can i validate, using validators, if the selected listbox has a selected
item?

Thanks.

Fernando
 
F

Fernando Lopes

Thanks Peter.
But how can i do that? I say this because my "unselected" value is a blank
ListItem.

Thanks again.
Fernando
 
P

Peter Blum

When there is no selection, the validator will retrieve to a value of ""
from the listbox. Your InitialValue property is already "". So just use the
RequiredFieldValidator without changing InitialValue.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top