0

Here is my code

Dim i As Integer
        Dim arrList As ArrayList
        If Session("Cart") Is Nothing Then
            arrList = New ArrayList()
        Else
            arrList = CType(Session("Cart"), ArrayList)
            Session("cart") = arrList

            Label1.Text = arrList.Count
        End If
        Dim s = arrList.Count
        For i = 0 To s - 1
            Dim dvdid As Integer
            dvdid = arrList.Item(i)
            Dim dt As New DataTable
           Dim dr As DataRow = dt.NewRow()
          
            dt = checkoutAdapter.GetCheckout(dvdid)
            ds.Tables.Add(dt)
            CheckoutGridView.DataSource = checkoutAdapter.GetCheckout(dvdid)
            CheckoutGridView.DataBind()


        Next

Here the datagridview shows only one row
I want the display all the values passsed through the loop

I crated checkout adapter using the query on a datatable.

please help me

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by serkan sendur
0

it is natural that it is going to have one row because you are setting the datasource and calling the databind method in the loop, each time loop iterates it binds the next row. to solve the problem you have to put those two lines right after the next statement. basically move these two lines
CheckoutGridView.DataSource = checkoutAdapter.GetCheckout(dvdid)
CheckoutGridView.DataBind()
after the next statement.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.