private void grdHotKeywords_RowCommand(object sender, GridViewCommandEventArgs e) { if ((e.CommandName == "Fall") || (e.CommandName == "Rise")) { int rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex; int hid = (int)grdHotKeywords.DataKeys[rowIndex].Value; int displaySequence = int.Parse((grdHotKeywords.Rows[rowIndex].FindControl("lblDisplaySequence") as Literal).Text); int replaceHid = 0; int replaceDisplaySequence = 0; if (e.CommandName == "Fall") { if ((rowIndex + 1) != grdHotKeywords.Rows.Count) { replaceHid = (int)grdHotKeywords.DataKeys[rowIndex + 1].Value; replaceDisplaySequence = int.Parse((grdHotKeywords.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as Literal).Text); } } else if ((e.CommandName == "Rise") && (rowIndex != 0)) { replaceHid = (int)grdHotKeywords.DataKeys[rowIndex - 1].Value; replaceDisplaySequence = int.Parse((grdHotKeywords.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as Literal).Text); } if (replaceHid != 0) { SubsiteStoreHelper.SwapHotWordsSequence(hid, replaceHid, displaySequence, replaceDisplaySequence); BindData(); } } }
private void grdHotKeywords_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (e.CommandName == "Fall" || e.CommandName == "Rise") { int rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex; int int_ = (int)this.grdHotKeywords.DataKeys[rowIndex].Value; int displaySequence = int.Parse((this.grdHotKeywords.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text); int num = 0; int replaceDisplaySequence = 0; if (e.CommandName == "Fall") { if (rowIndex + 1 != this.grdHotKeywords.Rows.Count) { num = (int)this.grdHotKeywords.DataKeys[rowIndex + 1].Value; replaceDisplaySequence = int.Parse((this.grdHotKeywords.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text); } } else { if (e.CommandName == "Rise" && rowIndex != 0) { num = (int)this.grdHotKeywords.DataKeys[rowIndex - 1].Value; replaceDisplaySequence = int.Parse((this.grdHotKeywords.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text); } } if (num != 0) { SubsiteStoreHelper.SwapHotWordsSequence(int_, num, displaySequence, replaceDisplaySequence); this.BindData(); } } }