validating multiple checkboxes
am 19.12.2007 15:16:19 von Ned BalzerHi,
Can anyone point me in the direction of a solution for validating
multiple checkboxes in an asp.net 2.0 page?
1) This is not a checkboxlist, it is a number of separate checkboxes
2) I do not need to ensure that they are checked, what I am trying to
do is lock down the page to prevent possible code injection. So, the
checkboxes can be either checked or unchecked, I don't care.
I have seen some sample code at http://msdn2.microsoft.com/en-us/library/aa479013.aspx.
I think this is a good start, and I think I can use a call such as
args.IsValid = ((CheckBox.Checked = True) or (Checkbox.Checked
= False))
But the problem I am having is I would like to have several
customvalidator controls share the same ServerValidation subroutine,
and so not have to specify the name of the checkbox control being
validated. So, my main question is really: is there any way to
extract the name of the checkbox from the source or
servervalidateeventargs (the arguments to the servervalidation
subroutine)?
Thanks in advance!
-- Ned