Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 to delete a row from database througgh gridview controls
Posted by sumit agarwal on  8/13/2007 6:50:41 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
i have problem to get id of item

Dim id As Integer = Convert.ToInt32(GridView1.DataKeys(e.RowIndex).Value)

m writing above code line to get id of item in rowdeleting command of gridview but i run it in browser & click on delete link there is a exception occured as

Server Error in '/WebSite4' Application.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

plz. help me........

Post Your Reply Post New Question

 Viewer's Reply
Add index to the Values
Answered By Moderator1 on 8/18/2007 11:46:24 PM
Please try like this.

Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
The Art & Science of JavaScript - Free 100 Page Preview!
Easing the Migration to Microsoft SQL Server 2005