我收到此错误,我认为它来自单选按钮。关于如何解决这个问题的任何想法?
这是aspx:
<asp:RadioButton ID="radL" runat="server" GroupName="Gender" Checked="false" Text="L" AutoPostBack="true" />
<asp:RadioButton ID="radP" runat="server" GroupName="Gender" Checked="false" Text="P" AutoPostBack="true" />
后面的代码:
RadioButton radL = (RadioButton)editedItem.FindControl("radL");
RadioButton radP = (RadioButton)editedItem.FindControl("radP");
RadioButton JAN = (RadioButton)editedItem.FindControl("JAN");
if (radL.Checked == true)
{
JAN = radL;
}
else
{
JAN = radP;
}
SqlConnection conn1 = BusinessTier.getConnection();
conn1.Open();
int flg = BusinessTier.SavePersonalInfo(conn1, 1, txtEmpNo.Text.ToString().Trim(), txtJobTitle.Text.ToString().Trim(), Convert.ToInt32(txtKod.Text.ToString().Trim()), txtJenis.Text.ToString().Trim(),
txtNama.Text.ToString().Trim(), txtNokp.Text.ToString().Trim(), TLAHIR.SelectedDate.Value, Convert.ToInt32(txtUmur.Text.ToString().Trim()), JAN.Text.ToString().Trim(), txtRas.Text.ToString().Trim(), txtBadge.Text.ToString().Trim(), txtKerja.Text.ToString().Trim(),
txtKodclin.Text.ToString().Trim(), txtKc.Text.ToString().Trim(), txtAdd1.Text.ToString().Trim(), txtAdd2.Text.ToString().Trim(), txtAdd3.Text.ToString().Trim(), txtAlgr.Text.ToString().Trim(), Session["sesUserID"].ToString(), "N");
BusinessTier.DisposeConnection(conn1);