R
Roshawn
Hi,
I am using a dataset for a web application. The dataset contains 10 items
when the Products.aspx is loaded. Only 10 items will be shown at a time on
this page. On the page there is a label control placed inside a repeater
control (along with other controls). This label displays the product number
(supposed to be the index of the product).
All works well on the page as product info is displayed to the user.
Whenever I post the page back to the server and add 10 more items to the
dataset, the label control continues to list the product numbers 1-10. It
appears that it isn't continuing the count.
Can anyone help me? Here's my code:
For i = 0 To pinfo.Details.Length - 1 'counts the items on the page
Dim row As DataRow = ds.Tables(0).NewRow
row("No.") = i + 1 'simply count the # of products
row("ProductName") = pinfo.Details(i).ProductName
row("ASIN") = pinfo.Details(i).Asin
row("ListPrice") = pinfo.Details(i).ListPrice
row("OurPrice") = pinfo.Details(i).OurPrice
row("ImageUrlSmall") = pinfo.Details(i).ImageUrlSmall
ds.Tables(0).Rows.Add(row)
Next
Me.Repeater1.DataSource = ds.Tables(0)
Me.Repeater1.DataBind()
The problem appears to be inside the For...Next loop (particularly
row("No.") as I haven't figured out a way to change its behavior)
Thanks for your help
Roshawn
I am using a dataset for a web application. The dataset contains 10 items
when the Products.aspx is loaded. Only 10 items will be shown at a time on
this page. On the page there is a label control placed inside a repeater
control (along with other controls). This label displays the product number
(supposed to be the index of the product).
All works well on the page as product info is displayed to the user.
Whenever I post the page back to the server and add 10 more items to the
dataset, the label control continues to list the product numbers 1-10. It
appears that it isn't continuing the count.
Can anyone help me? Here's my code:
For i = 0 To pinfo.Details.Length - 1 'counts the items on the page
Dim row As DataRow = ds.Tables(0).NewRow
row("No.") = i + 1 'simply count the # of products
row("ProductName") = pinfo.Details(i).ProductName
row("ASIN") = pinfo.Details(i).Asin
row("ListPrice") = pinfo.Details(i).ListPrice
row("OurPrice") = pinfo.Details(i).OurPrice
row("ImageUrlSmall") = pinfo.Details(i).ImageUrlSmall
ds.Tables(0).Rows.Add(row)
Next
Me.Repeater1.DataSource = ds.Tables(0)
Me.Repeater1.DataBind()
The problem appears to be inside the For...Next loop (particularly
row("No.") as I haven't figured out a way to change its behavior)
Thanks for your help
Roshawn