protected void Update(object sender, EventArgs e) { try { GridViewRow gvr = (GridViewRow)(((Control)sender).NamingContainer); { LinkButton imgEdit = (LinkButton)gvr.FindControl("lnkEdit"); Label lblProgramsID = (Label)gvr.FindControl("lblProgramsID"); Label lblTitle = (Label)gvr.FindControl("lblTitleName"); Label lblActive = new Label(); DataTable dt = new DataTable(); objML_Logn.ID = lblProgramsID.Text != "" ? lblProgramsID.Text : null; dt = objBL_Login.BL_EditUser(objML_Logn); if (dt.Rows.Count > 0) { txtFirstName.Text = dt.Rows[0]["First_Name"].ToString(); txtLastName.Text = dt.Rows[0]["Last_Name"].ToString(); txtEmail.Text = dt.Rows[0]["E_mail"].ToString(); txtdate.Text = dt.Rows[0]["DOB"].ToString(); txtPhoneNo.Text = dt.Rows[0]["Phone"].ToString(); lblID.Text = dt.Rows[0]["User_Code"].ToString(); ddlGender.SelectedItem.Text = dt.Rows[0]["Gender"].ToString(); ddlExamList.SelectedValue = dt.Rows[0]["ExamName"].ToString(); btnSave.Text = "Update"; string Practice = ""; Practice = dt.Rows[0]["PraticeType"].ToString(); string AdminGroup = ""; AdminGroup = dt.Rows[0]["AdminGroup"].ToString(); if (Practice == "0") { chkPratice.Checked = false; ddlExamList.Enabled = true; } else { chkPratice.Checked = true; ddlExamList.Enabled = false; } if (AdminGroup == "0") { chhkAdminGroup.Checked = false; } else { chhkAdminGroup.Checked = true; } } } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + ex.Message.ToString() + "');", true); } }