View Single Post
  #22 (permalink)  
Old July 14th, 2011, 09:02 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Code:
 
while (stillInPostedSampleCode)
{
  You cannot use MsgBox in a Web App
}
Code:
 
while (notPosted)
{
  How does your stored procedure look? 
  Is it set up to delete an item by its ID? 
  It looks like you're not passing the record's ID, but the relative index in the GridView  instead. 
  You may want to query the GridView's DataKeys collection to get the underlying item ID.
  Please post your relevant code and a clear problem description
}
In other words: you have to help us help you. I am not psychic, don't know how your GridView looks like, where it gets its data from, what happens when you debug the code, whether or not the code even compiles, what you see when you step through it with the debugger, what you know or don't know about GridView.DataKeys, etc etc etc.

Without all that, I don't understand how you think we can help you. It *looks* like you're trying to delete a record with an *ID* that matches the *index* of the record in the GridVew which is unlikely to work, but it's hard to say without relevant information.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!