ASP.NET 3.5 and above only

ASP.NET TreeView - Shopping Cart demo with obout Grid

Checkout the products just by drag and drop the products in the grid.

  • oboutSuite
    • TreeView
    • Grid
    • Calendar
    • HTMLEditor
    • SlideMenu
    • EasyMenu
    • ComboBox
    • Ajax Page
    • Show
    • Interface Controls
Product Name
UnitPrice
Qty
Price
Delete
 
 
 
 
 
 
 
 
There are no records available.
 
 
 
 
Total:
$0
 
 
 
 
[ASPX]

            <obout:Tree NodeDropTargets="UpdatePanel1" OnTreeNodeDrop="ObTree_TreeNodeDrop" 
                        EnableDragAndDrop="true" runat="server">
                    <Nodes>
                        <obout:Node Text="oboutSuite" Value="199">
                        </obout:Node>
                        .....
                    </Nodes>
             </obout:Tree>
             <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <obout:Grid ID="grid1" ...>
                                </obout:Grid>
                            </ContentTemplate>
             </asp:UpdatePanel>
            
[C#]

             protected void ObTree_TreeNodeDrop(object sender, Obout.Ajax.UI.TreeView.NodeDropEventArgs e)
             {
                System.Collections.Generic.List<ShoppingCartRow> source = CheckoutList;
                ShoppingCartRow item = source.Find(delegate(ShoppingCartRow row)
                {
                    return row.ProductName == e.SourceNode.Text;
                });
                if (item == null)
                {
                    source.Add(
                        new ShoppingCartRow(e.SourceNode.Text, double.Parse(e.SourceNode.Value), 1)
                    );
                }
                else
                {
                    item.Quantity++;
                }
                CheckoutList = source;

                grid1.DataSource = this.CheckoutList;
             }
            
[VB]

            Protected Sub ObTree_TreeNodeDrop(ByVal sender As Object, ByVal e As Obout.Ajax.UI.TreeView.NodeDropEventArgs)
                Dim source As System.Collections.Generic.List(Of ShoppingCartRow) = CheckoutList
                Dim item As ShoppingCartRow = source.Find(Function(row As ShoppingCartRow) row.ProductName = e.SourceNode.Text)
                If item Is Nothing Then
                    source.Add(New ShoppingCartRow(e.SourceNode.Text, Double.Parse(e.SourceNode.Value), 1))
                Else
                    item.Quantity += 1
                End If
                CheckoutList = source

                grid1.DataSource = Me.CheckoutList
             End Sub
            

"Boys… You are the best ones."

Alvaro Torres Tatis

Random testimonial   All testimonials