protected void dgvProduct_RowCommand(object sender, GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { objCommon = new clsCommon(); hdnPKID.Value = e.CommandArgument.ToString(); if (e.CommandName == "Save") { objCommon = new clsCommon(); objTrending = new tblTrending(); objTrending.AddNew(); objTrending.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblTrending", tblTrending.ColumnNames.AppDisplayOrder); objTrending.s_AppProductID = e.CommandArgument.ToString(); objTrending.AppIsActive = true; objTrending.Save(); objTrending = null; objCommon = null; LoadTrending1(true, false); LoadDataGrid(true, false); } } }
protected void dgvGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { objCommon = new clsCommon(); hdnPKID.Value = e.CommandArgument.ToString(); if (e.CommandName == "Up") { LinkButton inkButton = (LinkButton)e.CommandSource; GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent; if (drCurrent.RowIndex > 0) { GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex - 1]; objCommon.SetDisplayOrder("tblTrending", tblTrending.ColumnNames.AppTrendingID, tblTrending.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[2], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[2]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "Down") { LinkButton lnkButton = (LinkButton)e.CommandSource; GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent; if (drCurrent.RowIndex < dgvGridView.Rows.Count - 1) { GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex + 1]; objCommon.SetDisplayOrder("tblTrending", tblTrending.ColumnNames.AppTrendingID, tblTrending.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[2], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[2]); //objCommon.SetDisplayOrder("tblBestSeller", tblBestSeller.ColumnNames.AppBestSellerID, tblBestSeller.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[2], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[2]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "IsActive") { objTrending = new tblTrending(); if (objTrending.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { if (objTrending.AppIsActive == true) { objTrending.AppIsActive = false; } else if (objTrending.AppIsActive == false) { objTrending.AppIsActive = true; } objTrending.Save(); LoadDataGrid(false, false, "", ""); } objTrending = null; } } }