Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error Message
Message
From
06/05/2004 11:24:30
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
04/05/2004 11:31:26
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00900533
Message ID:
00901595
Views:
12
>The error is pointing to this line:
>myCommand.Parameters("@id").Value = Me.grdProducts.DataKeys(CInt(e.Item.ItemIndex))
>
>Error message is:
>"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
>
>I have done the following trying to solve this problem but nothing yet:
>I have added a primary key to my table.
>I have added a column to my grid to display the primary key field.
>
>Any suggestions?

Chris,

I'm sorry for not replying sooner.

Instead of using the DataKeys collection, use the primary key column's control:
myCommand.Parameters("@id").Value = CType(e.Item.FindControl("myPKLabel"), Label).Text
Previous
Reply
Map
View

Click here to load this message in the networking platform