日期:2014-05-20  浏览次数:20878 次

如何判断checkbox是否被选中??
C# code

  protected void btnOK_Click(object sender, EventArgs e)
    {

        System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
        System.Web.UI.HtmlControls.HtmlInputCheckBox ck;
        string cc="";
        for (int i = 0; i < rpt310GuessAdd.Items.Count; i++)
        { 
            cc = nc.GetValues("SMONEY")[i].ToString();
            //
            //这里怎么获取ck是否被选中
            ck=(HtmlInputCheckBox)------这一句怎么写??
            if (ck.Checked)
            {
                 ck.Disabled = false;            }
         

        }
      

    }




------解决方案--------------------
你要是想使用
HtmlInputCheckBox 
你必须设置runat=server

<input name="CI" id='CI' runat=server type="checkbox" value='<%#Eval("Guess_310_Child_Result") %>' 
onclick="chCI('<%#Eval("Guess_310_Child_Result") %>');" />