Search code examples
c#asp.net.net-3.5requiredfieldvalidator

Field validators in asp.net


Is it possible to have "Required Field Validator" controls to validate more than one field (example I have 12 textboxes that are required. I want to try an avoid having 12 RFV controls. If a validation does get triggered, is there a way to display a customized message ("textA is empty" or "textB is empty") etc.?


Solution

  • You can create a custom validator that goes through validates all the controls.

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.customvalidator.aspx

    The Required Field Validator can only validate one control at a time.