private void grdGroupList_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { int rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex; int linkId = (int)this.grdGroupList.DataKeys[rowIndex].Value; if (e.CommandName == "SetYesOrNo") { FriendlyLinksInfo friendlyLink = SubsiteStoreHelper.GetFriendlyLink(linkId); if (friendlyLink.Visible) { friendlyLink.Visible = false; } else { friendlyLink.Visible = true; } SubsiteStoreHelper.UpdateFriendlyLink(friendlyLink); this.BindFriendlyLinks(); return; } int displaySequence = int.Parse((this.grdGroupList.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text); int num = 0; int replaceDisplaySequence = 0; if (e.CommandName == "Fall") { if (rowIndex < this.grdGroupList.Rows.Count - 1) { num = (int)this.grdGroupList.DataKeys[rowIndex + 1].Value; replaceDisplaySequence = int.Parse((this.grdGroupList.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text); } } else { if (e.CommandName == "Rise" && rowIndex > 0) { num = (int)this.grdGroupList.DataKeys[rowIndex - 1].Value; replaceDisplaySequence = int.Parse((this.grdGroupList.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text); } } if (num > 0) { SubsiteStoreHelper.SwapFriendlyLinkSequence(linkId, num, displaySequence, replaceDisplaySequence); this.BindFriendlyLinks(); } }
private void grdGroupList_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex; int linkId = (int)grdGroupList.DataKeys[rowIndex].Value; if (e.CommandName == "SetYesOrNo") { FriendlyLinksInfo friendlyLink = SubsiteStoreHelper.GetFriendlyLink(linkId); if (friendlyLink.Visible) { friendlyLink.Visible = false; } else { friendlyLink.Visible = true; } SubsiteStoreHelper.UpdateFriendlyLink(friendlyLink); BindFriendlyLinks(); } else { int displaySequence = int.Parse((grdGroupList.Rows[rowIndex].FindControl("lblDisplaySequence") as Literal).Text); int replaceLinkId = 0; int replaceDisplaySequence = 0; if (e.CommandName == "Fall") { if (rowIndex < (grdGroupList.Rows.Count - 1)) { replaceLinkId = (int)grdGroupList.DataKeys[rowIndex + 1].Value; replaceDisplaySequence = int.Parse((grdGroupList.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as Literal).Text); } } else if ((e.CommandName == "Rise") && (rowIndex > 0)) { replaceLinkId = (int)grdGroupList.DataKeys[rowIndex - 1].Value; replaceDisplaySequence = int.Parse((grdGroupList.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as Literal).Text); } if (replaceLinkId > 0) { SubsiteStoreHelper.SwapFriendlyLinkSequence(linkId, replaceLinkId, displaySequence, replaceDisplaySequence); BindFriendlyLinks(); } } }