protected void gvRoles_RowCommand(object sender, GridViewCommandEventArgs e) { try { lblInfo.Text = string.Empty; lblRoleNameError.Text = string.Empty; if (e.CommandName == "Status") { LinkButton imgStatus = (LinkButton)e.CommandSource; // the button GridViewRow grRow = (GridViewRow)imgStatus.Parent.Parent; // the row GridView grimage = (GridView)sender; // the gridview string ID = grimage.DataKeys[grRow.RowIndex].Value.ToString(); Role.ActiveDeactiveRole(Convert.ToInt32(e.CommandArgument), Conversion.ParseInt(ddlRole.SelectedItem.Value)); // lblError.Visible = false; int groupId = Conversion.ParseInt(ddlRole.SelectedItem.Value); loadRolesbyGroupId("1", groupId); } else if (e.CommandName == "Delete") { DataSet ds = null; hdnSubRoleTypeId.Value = e.CommandArgument.ToString(); ds = Groups.getUserRolesStatusByRoleId(Conversion.ParseInt(e.CommandArgument)); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { dvUserRoleInfo.Visible = true; gvUserRoleInfo.DataSource = ds; gvUserRoleInfo.DataBind(); } else { RoleId = Conversion.ParseInt(e.CommandArgument); Groups.deleteRolebyRoleId(RoleId); int groupId = Conversion.ParseInt(ddlRole.SelectedItem.Value); loadRolesbyGroupId("1", groupId); } } else if (e.CommandName == "Edit") { RoleId = Conversion.ParseInt(e.CommandArgument); } } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "AddRole.aspx.gvRoles_RowCommand", ex); } }