如果得到用户选定的项? 只能使用CheckBox 不能使用CheckBoxList 怎么办??
<form id="Form1" method="post" runat="server"><asp:checkbox id="cb1" runat="server" Text="刘德华"></asp:checkbox>
<asp:checkbox id="cb2" runat="server" Text="张学友"></asp:checkbox>
<asp:checkbox id="cb3" runat="server" Text="郭富城"></asp:checkbox>
<asp:checkbox id="cb4" runat="server" Text="黎明"></asp:checkbox><asp:button id="Button1" runat="server" Text="提交"></asp:button></form>

解决方案 »

  1.   

    怎么判断,连Value属性都没有
      

  2.   

    看你的html应该是动态生成的
    foreach (Control c in this.Controls[1].Controls)
    {
    if (c is CheckBox)
    {
    CheckBox Chk = (CheckBox)c;
    if(Chk.Checked)
                                                     {
                                                 .....................
                                                     }
    }
    }
    注意如果CheckBox包含在其他容器都则找不到,
    需要单独遍历其容器
      

  3.   

    if(cb1.Checked)
       Response.Write(cb1.Text) ;
      

  4.   

    CheckBox有checked属性,同value属性一样。