Repeater控件html如下:
<asp:Repeater ID="RT" runat="server">
                    <ItemTemplate>
                        <asp:CheckBox ID="cbResDept" runat="server" />
                        <asp:Label ID="lblResDept" runat="server" Text=' <%#Eval("dname")%>'></asp:Label>
                    </ItemTemplate>
</asp:Repeater>

解决方案 »

  1.   

    1 foreach (Control c in this.Repeater1.Controls) 
    2  { 
    3  HtmlInputCheckBox check = (HtmlInputCheckBox)c.FindControl("chkSelect"); 
    4  if( check != null ) 
    5  { 
    6  check.Checked = true; 
    7  } 
    8  } 
      

  2.   

    1 for (int i=0;i<this.Repeater1.Items.Count;i++) 
    2  { 
    3  HtmlInputCheckBox check = (HtmlInputCheckBox)this.Repeater1.Items[i].FindControl("chkSelect"); 
    4  if( check != null ) 
    5  { 
    6  check.Checked = true; 
    7  } 
    8  } 
    1 foreach( RepeaterItem item in this.Repeater1.Items ) 
    2  { 
    3  HtmlInputCheckBox check = (HtmlInputCheckBox)item.FindControl("chkSelect"); 
    4  if( check != null ) 
    5  { 
    6  check.Checked = true; 
    7  } 
    8  } 
      

  3.   

    SelectAlls=function()
    {
    var a=document.getelementbyid('repeat1').getelementsbytag("checkbox");
    for(var i in a)
    {
    i.checked=true;
    }
    }
    大概这样具体试下了.
      

  4.   

    var chk;
                    var arr = $id("<%=repeater1.ClientID %>").getElementsByTagName("input");
                    for(var i=0;i<arr.length;i++)
                    {
                        if(arr[i].type == "checkbox")
                        {
                            if(i==0) chk = arr[i].checked;
                            arr[i].checked = !chk;
                        }
                    }
      

  5.   


    var items = document.getElementById("<%=RT.ClientID %>").getElementsByTagName("input");
        var hidNumItems = "";
        for (var i = 0; i < items.length; i++) {
            var a = items[i].type;
            if (items[i].type == "checkbox" && items[i].value != "all") {
                items[i].checked = obj.checked;
                hidNumItems = hidNumItems + items[i].value + ',';
            }
        }
      

  6.   

    要获取这个text值可以在他们后面加一个label控件  label在前台显示的是span标签
    <input type="chechbox" value="1" name="selectValue" /><label>向晶</label>
    <input type="chechbox" value="3" name="selectValue" /><label>其他</label>
    <input type="chechbox" value="2" name="selectValue" /><label>好多</label>这样 可以先用 var tb=document.getElementByID("table")   //如果check 在table 下面 就这样,如果没有 直接获取它的NAME
                    var chk=tb.getElementByTanName("input")
    var str=""; 
             for(var i=0;i<chk.length;i++)
    {
               var ta=  chk[i].nextSibling  //chechbox的下一个节点
                      str+=ta.innerText;             
    }
      <input type='hidden' name='hid_name' value='"+str+"' /> 用hidden 接收  后台reque.from["hid_name"]获取
      

  7.   

    var items = document.getElementById("<%=RT.ClientID %>").getElementsByTagName("input");
    在VS2010里面,这个第一句定义的话就不对!