w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Telerik radgrid paging in webshop, breaks when changing product amount on last page

The guys at Telerik helped me, the problem was that I was going through all items and not just the one where the amount changed.

Updated tbQuantity_TextChanged

protected void tbQuantity_TextChanged(object sender, EventArgs
e)
    {
        if (!_readMode)
        {
            RadNumericTextBox tbQuantity = (RadNumericTextBox)sender;
            GridDataItem dataItem =
(GridDataItem)tbQuantity.NamingContainer;

            var shopItemID = (int)dataItem.GetDataKeyValue("ID");
            var shopItem = _sessionHelper.CurrentCart.CartItems.Find(x
=> x.ID == shopItemID);

            if (!shopItem.IsExternal)
            {
                _sessionHelper.CurrentCart.CartItems.Find(x => x.ID ==
shopItemID).Quantity = Convert.ToInt32(tbQuantity.Text);
                _sessionHelper.CurrentCart.CartItems.Find(x => x.ID ==
shopItemID).TotalPrice = _sessionHelper.CurrentCart.GetItemCost(shopItemID,
false);
                _shopItemHolder = _sessionHelper.CurrentCart;
            }

            loadItemsSummary();
            gvCartItems.Rebind();
        }
    }




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.