protected void gvInspectorDoc_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int index = e.Row.RowIndex; DropDownList ddlInspector = (DropDownList)e.Row.Cells[0].FindControl("ddlInspector"); Label lblItemValueGvInspectorDoc = (Label)e.Row.Cells[0].FindControl("lblItemValueGvInspectorDoc"); CheckBox chkSpecifiedValueInspectorDoc = (CheckBox)e.Row.Cells[0].FindControl("chkSpecifiedValueInspectorDoc"); if (lblItemValueGvInspectorDoc.Text != "Y") { chkSpecifiedValueInspectorDoc.Checked = false; } else { chkSpecifiedValueInspectorDoc.Checked = true; } var message = SysMessage.DefaultSelecting; BLL.DataCenterBiz biz = new BLL.DataCenterBiz(); var ls = biz.GetAssociateToSetting(message); BindToDDL(ddlInspector, ls.DataResponse.ToList()); Label lblValueGvInspectorDoc = (Label)e.Row.Cells[0].FindControl("lblValueGvInspectorDoc"); if (lblValueGvInspectorDoc.Text != null) { var value = lblValueGvInspectorDoc.Text; ddlInspector.SelectedValue = value; } } }