validation in asp.net using validators
i am using validator for validating blank textbox. my problem is,i want to ma开发者_C百科ke the validation to false means the textbox can be blank,when i select Complete from dropdownlist.
How can i do this.
You can disable an ASP.NET validator using JavaScript. Tap into the onchange
JavaScript event on your drop down list to invoke the disabling code, and that should do it.
Alternatively, if your combo box is posting back, you can disable or hide the validator in code behind by setting its Visible
or Enabled
property to false
.
Handle it in the dropdownlist change event, set the Enabled
property of the validation control to false
.
Or thru JavaScript set the validation control enabled to false. Note: Validation control must be set to EnableClientScript=true
.
精彩评论