protected void grdNavigate_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex; int bannerId = (int)this.grdNavigate.DataKeys[rowIndex].Value; int replaceBannerId = 0; if (e.CommandName == "Fall") { if (rowIndex < (this.grdNavigate.Rows.Count - 1)) { replaceBannerId = (int)this.grdNavigate.DataKeys[rowIndex + 1].Value; } } else if ((e.CommandName == "Rise") && (rowIndex > 0)) { replaceBannerId = (int)this.grdNavigate.DataKeys[rowIndex - 1].Value; } if (replaceBannerId > 0) { VShopHelper.SwapTplCfgSequence(bannerId, replaceBannerId); base.ReloadPage(null); } if (e.CommandName == "Delete") { if (VShopHelper.DelTplCfg(bannerId)) { this.ShowMsg("删除成功!", true); base.ReloadPage(null); } else { this.ShowMsg("删除失败!", false); } } }
protected void grdRecommend_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 num = (int)this.grdRecommend.DataKeys[rowIndex].Value; int num2 = 0; if (e.CommandName == "Fall") { if (rowIndex < this.grdRecommend.Rows.Count - 1) { num2 = (int)this.grdRecommend.DataKeys[rowIndex + 1].Value; } } else { if (e.CommandName == "Rise" && rowIndex > 0) { num2 = (int)this.grdRecommend.DataKeys[rowIndex - 1].Value; } } if (num2 > 0) { VShopHelper.SwapTplCfgSequence(num, num2); base.ReloadPage(null); } if (e.CommandName == "Delete") { if (VShopHelper.DelTplCfg(num)) { this.ShowMsg("删除成功!", true); base.ReloadPage(null); return; } this.ShowMsg("删除失败!", false); } }