protected void Page_Load(object sender, EventArgs e) { // locate the basket item to set gift options for int basketItemId = AlwaysConvert.ToInt(Request.QueryString["i"]); Basket basket = AbleContext.Current.User.Basket; _BasketItem = basket.Items.FirstOrDefault(bi => bi.Id.Equals(basketItemId)); if (_BasketItem == null || _BasketItem.Product == null || _BasketItem.Product.WrapGroup == null) { // unknown item or item is not eligible for gift wrap Response.Redirect("ShipMethod.aspx"); } // update shipping address BasketShipment shipment = BasketShipmentDataSource.Load(_BasketItem.ShipmentId); if (shipment != null && shipment.Address != null) { ShippingAddress.Text = shipment.Address.ToString(); } // bind list GiftItemsGrid.DataSource = GetGiftItemsList(_BasketItem); GiftItemsGrid.DataBind(); }
// bind list protected void ShowGiftOptionsDialog(BasketItem basketItem) { GiftDialogCaption.Text = string.Format(GiftDialogCaption.Text, basketItem.Name); GiftOptionsBasketItemId.Value = basketItem.Id.ToString(); GiftItemsGrid.DataSource = GetGiftItemsList(basketItem); GiftItemsGrid.DataBind(); phGiftOptions.Visible = true; GiftOptionsPopup.Show(); }