<asp:CheckBox ID="IncludePic" Checked="false" runat="server" />上面的代码没完,我想要的结果是:
当"选择"时,后台 this.IncludePic.Text的值为1
当"没有选择时,后台 this.IncludePic.Text的值为0

解决方案 »

  1.   

    if (IncludePic.checked)
    this.IncludePic.Text = 1;
    else
    this.IncludePic.Text = 0;
      

  2.   


    //在checkedchanged事件中写
    protected void IncludePic_CheckedChanged(object sender, EventArgs e)
        {
            if (this.IncludePic.Checked)
            {
                this.IncludePic.Text = "0";        }
            else
            {
                this.IncludePic.Text = "1";
            }
        }注意AutoPostBack="True"<asp:CheckBox ID="IncludePic" runat="server" AutoPostBack="True" OnCheckedChanged="IncludePic_CheckedChanged"  />
            <asp:CheckBox ID="CheckBox1" runat="server" />