protected void gvGroups_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Edit") { dvGroupsInfo.Visible = false; groupid = Convert.ToInt32(e.CommandArgument); } else if (e.CommandName == "Delete") { DataSet ds = null; ds = Groups.getRolesStatusByGroupId(Conversion.ParseInt(e.CommandArgument)); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { dvGroupsInfo.Visible = true; gvGroupsInfo.DataSource = ds; gvGroupsInfo.DataBind(); } else { if (Convert.ToBoolean(hdfactive.Value) == true) { Groups.ActiveDeactiveGroup(Convert.ToInt32(e.CommandArgument), false); } else { Groups.ActiveDeactiveGroup(Convert.ToInt32(e.CommandArgument), true); } loadGroups(); } } else if (e.CommandName == "AddMore") { dvGroupsInfo.Visible = false; LinkButton lnkbtnAddMoreGroup = gvGroups.FooterRow.FindControl("lnkbtnAddMore") as LinkButton; LinkButton lnkbtnAddGroup = gvGroups.FooterRow.FindControl("lnkbtnAddGroup") as LinkButton; LinkButton lnkbtnCancelGroup = gvGroups.FooterRow.FindControl("lnkbtnCancelGroup") as LinkButton; lnkbtnAddGroup.Visible = true; lnkbtnAddMoreGroup.Visible = false; lnkbtnCancelGroup.Visible = true; TextBox txtGroupNamefoot = gvGroups.FooterRow.FindControl("txtGroupNamefooter") as TextBox; txtGroupNamefoot.Visible = true; } else if (e.CommandName == "CancelGroup") { dvGroupsInfo.Visible = false; gvGroups.EditIndex = -1; loadGroups(); } else if (e.CommandName == "Insert") { dvGroupsInfo.Visible = false; TextBox txtGroupName = gvGroups.FooterRow.FindControl("txtGroupNamefooter") as TextBox; Label lblInfo = gvGroups.FooterRow.FindControl("lblInfoF") as Label; Groups grp = new Groups(); grp.vchName = txtGroupName.Text; grp.intGroupID = 0; int status = Groups.getGroupNameStatus(txtGroupName.Text); if (status == 0) { Groups.InsertUpdateGroups(grp); loadGroups(); } else { lblInfo.Text = "Group Name Already Exist"; } } } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "AddGroups.aspx.gvGroups_RowCommand", ex); } }