Tuesday, 15 March 2011

c# - add independent validators to controls -



c# - add independent validators to controls -

i have asp.net, few controls on it. specifically, added required field validator on textbox on page (the text box has submit button).

i added required field validator on (different) textbox in edit item template of listview.

the problem both validators on page, can't posback without both of controls beingness valid. however, these controls belong different parts of page , want each 1 validated individually. there way that?

you can utilize validationgroup different groups of fields.

this property allows validate fields need validated specific postback.

so add together validationgroup attribute validators , buttons:

<asp:requiredfieldvalidator validationgroup="group1" ... /> <asp:button validationgroup="group1" .../>

more ditails on msdn: validationgroup property

c# asp.net validation

No comments:

Post a Comment