我将此代码放在我的 中gridview_SelectedIndexChanged
,但复选框仍然不会检查。如果我在gridview中选择的行之一上面有字母,我将如何更改代码O
,复选框会自动检查?
protected void gvAuto_SelectedIndexChanged(object sender, EventArgs e)
{
txtSurname.Text = gvAuto.SelectedRow.Cells[0].Text;
txtFN.Text = gvAuto.SelectedRow.Cells[1].Text;
txtOrg.Text = gvAuto.SelectedRow.Cells[2].Text;
txtAdd.Text = gvAuto.SelectedRow.Cells[3].Text.Replace(" ", "");
txtPosition.Text= gvAuto.SelectedRow.Cells[4].Text.Replace(" ", "");
txtTelNum1.Text = gvAuto.SelectedRow.Cells[5].Text.Replace(" ", "");
txtTelNum2.Text = gvAuto.SelectedRow.Cells[6].Text.Replace(" ", "");
txtTelNum3.Text = gvAuto.SelectedRow.Cells[7].Text.Replace(" ", "");
txtMobileNum.Text = gvAuto.SelectedRow.Cells[8].Text.Replace(" ", "");
txtEmail1.Text = gvAuto.SelectedRow.Cells[9].Text.Replace(" ", ""); ;
txtEmail2.Text = gvAuto.SelectedRow.Cells[10].Text.Replace(" ", "");
txtEmail3.Text = gvAuto.SelectedRow.Cells[11].Text.Replace(" ", "");
if (gvAuto.SelectedRow.Cells[12].Text.Replace(" ", "") == "")
{
cbCategory1.Checked = false;
}
else
{
cbCategory1.Checked = true;
}
txtValidate2.Text = gvAuto.SelectedRow.Cells[13].Text.Replace(" ", "");
}