umamahesh2020 -5 Light Poster
function ValidChkBox(source, args) {
            //var pnl = "tabContainer_tabPanel" + Pageno + "_MultipleChoice_" + ElementID;
            var chkChoiceList = document.getElementById('<%= chkChoiceList.ClientID %>');
            var chkChoice = chkChoiceList.getElementsByTagName('input');

            for (var i = 0; i < chkChoice.length; i++) {
                if (chkChoice[i].checked) {
                    args.IsValid = true;
                    return;
                }
            }
            args.IsValid = false;
        }

The aboue coding is i am using as validation Script for my application but is firing for checked checkboxlist also. Here i am giving my application view souce code for checkboxlist.

This is 1st checkbox Viewsource Code:
<table id="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList" class="Aligntext">
                                                        <tr>
                                                                <td><input id="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_0" type="checkbox" name="tabContainer$tabPanel2$MultipleChoice_4905$chkChoiceList$0" value="2351" /><label for="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_0">One</label></td>
                                                        </tr><tr>
                                                                <td><input id="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_1" type="checkbox" name="tabContainer$tabPanel2$MultipleChoice_4905$chkChoiceList$1" value="2352" /><label for="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_1">Two</label></td>
                                                        </tr><tr>
                                                                <td><input id="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_2" type="checkbox" name="tabContainer$tabPanel2$MultipleChoice_4905$chkChoiceList$2" value="2353" /><label for="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_2">Three</label></td>
                                                        </tr><tr>
                                                                <td><input id="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_3" type="checkbox" name="tabContainer$tabPanel2$MultipleChoice_4905$chkChoiceList$3" value="2354" /><label for="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_3">Four</label></td>
                                                        </tr><tr>
                                                                <td><input id="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_4" type="checkbox" name="tabContainer$tabPanel2$MultipleChoice_4905$chkChoiceList$4" value="2355" /><label for="tabContainer_tabPanel2_MultipleChoice_4905_chkChoiceList_4">Five</label></td>
                                                        </tr>
                                                </table>
This is 2nd checkbox Viewsource Code:
<table id="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0" class="Aligntext">
                                                                                                        <tr>
                                                                                                                <td><input id="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_0_0" type="checkbox" name="tabContainer$tabPanel2$GridView_4906$gvGridViewOrTable$ctl02$MultipleChoice_4908$chkChoiceList$0" value="2356" /><label for="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_0_0">1</label></td>
                                                                                                        </tr><tr>
                                                                                                                <td><input id="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_1_0" type="checkbox" name="tabContainer$tabPanel2$GridView_4906$gvGridViewOrTable$ctl02$MultipleChoice_4908$chkChoiceList$1" value="2357" /><label for="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_1_0">2</label></td>
                                                                                                        </tr><tr>
                                                                                                                <td><input id="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_2_0" type="checkbox" name="tabContainer$tabPanel2$GridView_4906$gvGridViewOrTable$ctl02$MultipleChoice_4908$chkChoiceList$2" value="2358" /><label for="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_2_0">3</label></td>
                                                                                                        </tr><tr>
                                                                                                                <td><input id="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_3_0" type="checkbox" name="tabContainer$tabPanel2$GridView_4906$gvGridViewOrTable$ctl02$MultipleChoice_4908$chkChoiceList$3" value="2359" /><label for="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_3_0">4</label></td>
                                                                                                        </tr><tr>
                                                                                                                <td><input id="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_4_0" type="checkbox" name="tabContainer$tabPanel2$GridView_4906$gvGridViewOrTable$ctl02$MultipleChoice_4908$chkChoiceList$4" value="2360" /><label for="tabContainer_tabPanel2_GridView_4906_gvGridViewOrTable_MultipleChoice_4908_0_chkChoiceList_0_4_0">5</label></td>
                                                                                                        </tr>
                                                                                                </table>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.