Net validating checkbox

Posted by / 15-Dec-2019 03:33

This is what I did: I created a dummy textbox and put the ID of the checkboxlist as the value inside the text box. I sent the textbox as the control to validate, and then got the ID of my "real" control to validate from the value that was sent to the validation function, and used it to find my checkbox list and perform the validation checks. In such situations you should validate check box-selections before submitting the form.Use following multiple check box selection example to study the in Java Script. First you have to select at least 3 mobile phone manufactures from first check box group.i dnt want to give for txtbox i want to give for one of my form it is not compulsory to fill empid and recdvia...empid is a textboxand recdvia is a radiobuttonlistso for user thes two field are not compulsory but if the user is entering empid and he/she must hav to select recdvia so i want to give validation on recdvia if the user is entering empid then he has to select the recdvia if he/she not selecting then vl prompt message that please select recdvia.......It turned out that the validation does not work for Checkbox List.I found the following article about it: claims that there are 3 possible solutions: implement the validation not using the validation controls, use custom validation controls and write the validation methods, or create a custom control that does the validation the same way as the validation controls provided by the ASP. Since the third option is out of my scope for this project, I chose the second option, using the custom validation control.

* In this example there are tow error message types used to indicate the error. But of course I didn't want the user to see the dummy text box. When I did that, the validation method was never called. NET does not perform validation for a control whose visibility is false. The solution was to hide it by setting its "display" attribute to "none". To String(); // chk is the checkboxlist to validate txt Dummy. One last problem I had when developing this solution: When I only had the server-side validation method, things didn't work well, I could not see the error message and the operation wasn't stopped. After I added the javascript client-side validation function, everything worked just fine.

net validating checkbox-75net validating checkbox-68net validating checkbox-12

However, when I created a custom validation control and set the control to validate as my checkbox list, I got the same exception again - a checkbox list cannot be the control to validate, even for a custom validation control.