Bonjour,

J'ai trouvé ce code qui me permet de cocher toutes les chexbox de mon GridView, mais je ne veux cocher qu'une seule colonne à la fois! Comment puis-je faire? Les colonnes sont implémentées dans un GridView.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script type="text/javascript" language="javascript">
function SelectAllCheckboxes(spanChk){
    // Added as ASPX uses SPAN for checkbox
    var oItem = spanChk.children;
    var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
    xState=theBox.checked;
    elm=theBox.form.elements;
    for(i=0;i<elm.length;i+=3){
        if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
        {
            //elm[i].click();
            if(elm[i].checked!=xState)
            elm[i].click();
            //elm[i].checked=xState;
        }
    }
}
</script>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
<input id="chkAll" type="checkbox" onclick="SelectAllCheckboxes(this)">