/// <summary> /// Bind Related Products /// </summary> public void BindRelatedItems() { ProductCrossSellAdmin ProdCrossSellAccess = new ProductCrossSellAdmin(); DataSet MyDataSet = ProdCrossSellAccess.GetByProductID(ItemId); uxGrid.DataSource = MyDataSet; uxGrid.DataBind(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Update_Click(object sender, EventArgs e) { ProductCrossSellAdmin _ProdCrossAdmin = new ProductCrossSellAdmin(); bool status = true; // Loop through the grid values foreach (GridViewRow row in uxGrid.Rows) { CheckBox prodSelected = (CheckBox)row.Cells[0].FindControl("chkProduct") as CheckBox; if (prodSelected.Checked) { // Get ProductId int productId = int.Parse(row.Cells[1].Text); status &= _ProdCrossAdmin.Insert(ZNodeConfigManager.SiteConfig.PortalID, ItemID, productId); } } if (status) { Response.Redirect(ViewPage + ItemID + "&mode=crosssell"); } else { lblError.Visible = true; lblError.Text = "You are trying to add same product as Related Item"; } }
/// <summary> /// Event triggered when a command button is clicked on the grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void uxGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Page") { } else { if (e.CommandName == "RemoveItem") { ProductCrossSellAdmin _prodCrossSellAdmin = new ProductCrossSellAdmin(); bool Check = _prodCrossSellAdmin.Delete(int.Parse(e.CommandArgument.ToString()),ItemId,ZNodeConfigManager.SiteConfig.PortalID); if (Check) { this.BindRelatedItems(); } } } }