protected void GvData_RowCommand(object sender, GridViewCommandEventArgs e) { try { DataTable dtInfo = new DataTable(); GridViewRow gvrow = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); hdUniqueId.Value = GvData.DataKeys[gvrow.RowIndex].Value.ToString(); // fill the Location information for edit if (e.CommandName == "EditEntry") { objValidateData.ClearAllInputField(pnlDataEntry); dtInfo = objLtmsService.GetUserDtlById(Convert.ToInt64(hdUniqueId.Value)); if (dtInfo.Rows.Count > 0) { txtUserId.Text = dtInfo.Rows[0]["UserId"].ToString(); txtUserPassword.Text = dtInfo.Rows[0]["UserPassword"].ToString(); hdPassword.Value = dtInfo.Rows[0]["UserPassword"].ToString(); txtDisplayName.Text = dtInfo.Rows[0]["DisplayName"].ToString(); txtEmailId.Text = dtInfo.Rows[0]["EmailId"].ToString(); txtMobileNo.Text = dtInfo.Rows[0]["MobileNo"].ToString(); chkLocked.Checked = (dtInfo.Rows[0]["Locked"].ToString().ToUpper() == "TRUE"?true:false); ddlUserRoleId.SelectedValue = dtInfo.Rows[0]["UserRoleId"].ToString(); ddlUserRoleId_SelectedIndexChanged(ddlUserRoleId, null); } dtInfo.Dispose(); pnlDataEntry.Visible = true; pnlDataDisplay.Visible = false; btnSave.Text = "Update"; // lblSubHead.Text = "Update Location Information"; txtUserId.Focus(); } //Delete the location information if (e.CommandName == "DeleteEntry") { if (objMenuOptions.AllowDelete == false) { ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('You do not have proper privilege for deleting a record.');", true); return; } //dtInfo = objMstLocation.IsChildRecordExistForLocation(hdUniqueId.Value); //if (dtInfo.Rows.Count > 0) //{ // ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('This data already exist in another dependent table. Deletion failed !');", true); // dtInfo.Dispose(); // return; //} bool isDeleted = objLtmsService.DeleteInUser(Convert.ToInt64(hdUniqueId.Value)); if (isDeleted == true) { BindGvData(); ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('User information deleted.');", true); // ResetSearchFilte(); //BindLocationInformationDetails(cmbSearch.SelectedValue.ToString(), "", cmbSearch.SelectedValue.ToString(), true); } } dtInfo.Dispose(); } catch (Exception Ex) { objValidateData.SaveSystemErrorLog(Ex, Request.UserHostAddress); var message = new JavaScriptSerializer().Serialize("Some Error has occurred while performing your activity. Please contact the System Administrator for further assistance."); var script = string.Format("alert({0});", message); ScriptManager.RegisterClientScriptBlock(this, GetType(), "", script, true); } }