Last post Jan 15, 2006 08:35 PM by Lee Dumond
Nov 12, 2005 03:58 PM|PeleP|LINK
Nov 12, 2005 05:22 PM|PLBlum|LINK
Nov 17, 2005 12:31 AM|PeleP|LINK
Nov 17, 2005 03:48 PM|PLBlum|LINK
Nov 17, 2005 07:50 PM|PeleP|LINK
Nov 18, 2005 05:47 PM|PLBlum|LINK
Jan 14, 2006 05:41 PM|Lee Dumond|LINK
Sorry. The RequiredFieldValidator does NOT word with the CheckboxList.
Here's why -- Remember that the builtin validation controls also render client script. It gets the required validation property from the value attribute of the HTML element that gets rendered on the client. Since an HTML value attribute can't be two things
at once, the validated control must have a single logical value on the client.
This is why RadioButtonList can be validated, but CheckBoxList cannot
Jan 15, 2006 03:53 PM|PLBlum|LINK
You are correct. I don't know where my head was when I was writing those posts. I suspect I confused the RadioButtonList's support with the CheckBoxList. Oh well. Thanks for clearing it up.
Jan 15, 2006 06:49 PM|PeleP|LINK
Hello, thank you both for following up this post. Now I understand why it is not possible, so I can and will leave it for now. Maybe the new asp.net 2.0 can give a solution to this!? I will look into that later.
Anyway, I temporarily solved it by using ordinary CheckBox's and have validated them using some client code.
Thanks for your help!
Jan 15, 2006 08:35 PM|Lee Dumond|LINK
Yes, there are workarounds, thank goodness. Probably the easiest is to create a customvalidator with both server and client-side code.
ASP 2.0 does not provide a solution. Understand, the inability to validate the CheckBoxList never really was a limitation of ASP in the first place. It's really caused by the limitations of HTML. (Remember, no matter what, the server still has to render
HTML at the end of the whole deal.) There is no value= attribute of HTML checkboxes that let them determine the state of other checkboxes. Therefore, a built-in ASP validator couldn't automatically render "generic" client-side code for it.