I have 3 checkbox, id which is chkIPP, chkOutReach and chkCCA. When user check one of those checkbox, the value will be inserted into the BlogType column field. The 3 values that I want to be inserted are IPP Stories, OutReach Activities and CCA. I only want to allow one checkbox to be checked only. Only one value will be inserted into the blogType column field.
I think that the approximate control should be radio button or dropdownlist since only one can be selected and inserted into the database, but my teacher told me to use checkbox. So user will type in the 3 textbox, and check one of the checkboxes and the values will be inserted into the database. I already coded the 3 textboxes. Left with the checkboxes. Thanks


following @serhads suggestion. Did I did it correct?

protected void btnSubmit_Click(object sender, EventArgs e)
{
string AdminNumber = Convert.ToString(txtAdmin.Text);
string Name = Convert.ToString(txtName.Text);
string BlogStory = Convert.ToString(txtStory.Text);
insertGameRecord(AdminNumber, Name, BlogStory);
}
private void insertGameRecord(string admin, string name, string story)
{
try
{
string strConnectionString = ConfigurationManager.ConnectionStrings["BlogConnectionString"].ConnectionString;
SqlConnection myConnect = new SqlConnection(strConnectionString);
string strCommandText = "INSERT EntryTable(AdminNumber, Name, BlogStory, DateEntry) Values(@AdminNumber, @Name, @BlogStory, @DateEntry)";
SqlCommand cmd = new SqlCommand(strCommandText, myConnect);
cmd.Parameters.AddWithValue("@AdminNumber", admin);
cmd.Parameters.AddWithValue("@Name", name);
cmd.Parameters.AddWithValue("@BlogStory", story);
cmd.Parameters.Add("DateEntry", SqlDbType.DateTime);
cmd.Parameters["DateEntry"].Value = DateTime.Now;
myConnect.Open();
int result = cmd.ExecuteNonQuery();
if (result > 0)
{ lblError.Text = "Record Updated";
bindResultGridView();
}
else { lblError.Text = "Update fail"; }
myConnect.Close();
}
catch(Exception)
{
lblError.Text = "Please enter correct data";
}
}
