The Answer:
<form id="form1" runat="server">
<asp:checkbox id="chkBox" runat="server" text="Agreed" xmlns:asp="#unknown">
oncheckedchanged="chkBox_CheckedChanged" />
</form>
</asp:checkbox>
protected void chkBox_CheckedChanged(object sender, EventArgs e)
{
SqlConnection conn = null;
try
{
using (conn=new SqlConnection("YourConnectionString"))
{
String strSQL=String.Empty;
strSQL=String.Format("INSERT Test(Agrement) VALUES({0})",chkBox.Checked);
SqlCommand cmd=new SqlCommand();
cmd.Connection=conn;
cmd.CommandText=strSQL;
cmd.CommandType=System.Data.CommandType.Text;
int intResult=cmd.ExecuteNonQuery();
}
}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
conn=null;
}
}
Thanks,
Please read my newly posted article and Plz comments or vote.
A Framework for Software Application[
^]