title: How to validate if a RadioButtonList is check/select it in C#?
body: <p>I have a RadioButtonList which is being populated from a Database, users need to at at least check/select one of the RadioButtons. How can I make sure they check/select the RadioButton? I tried many different ways but no luck, here is my code. I'm also trying to alert them of the uncheck radiobutton.</p>
  
  <p>What I'm trying to do is to validate the RadioButtonList is checked/selected.</p>
  
  <pre><code>    if (cblstatus.SelectedItem.Value == "1")
      {
          //Create Category
          con.Open();
          SqlCommand departament = new SqlCommand("insert into categories(ca_name, ca_number, ca_status, ca_department, ca_date, ca_time, ca_user) " +
          "values('" + category.Text + "', '" + number.Text + "', 'Y', '" + catdepartment.SelectedValue + "', '" + date + "', '" + time + "', '" + user + "')", con);
          departament.ExecuteNonQuery();
          con.Close();
      }
      else if (cblstatus.SelectedItem.Value == "2")
      {
          //Create Category
          con.Open();
          SqlCommand departament = new SqlCommand("insert into categories(ca_name, ca_number, ca_status, ca_department, ca_date, ca_time, ca_user) " +
          "values('" + category.Text + "', '" + number.Text + "', 'N', '" + catdepartment.SelectedValue + "', '" + date + "', '" + time + "', '" + user + "')", con);
          departament.ExecuteNonQuery();
          con.Close();
      }
      else if (cblstatus. == null)
      {
          alert.InnerHtml = "&lt;div id=\"warning\" class=\"message warning\"&gt;Warning! Please select a department.&lt;/div&gt;" +
          "&lt;script&gt;" +
              "setTimeout(function () { $('#success').fadeOut(); }, 2000);" +
          "&lt;/script&gt;";
      }
  </code></pre>