OnDelete of grid has me stumped

I have some code in the OnDelete Command of my grid. The code figures out which ID a given row has and deletes the appropriate record for that ID. It works well EXCEPT that the code executes twice! Its not supposed to. I stepped through the whole thing and as soon as it binds, it starts right at the top again - it doesn't even exit the routine and come back in. So of course on the second go around I get an "index out of range" error. Has anyone seen this behavior before?<BR><BR>Thanks, Thomas<BR>Here is the OnDelete code<BR><BR>protected void dgUsers_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {<BR> <BR>int UserID=Convert.ToInt32(dgUsers.DataKeys[e.Item.ItemIndex]); <BR>Bugs.UsersDB db = new Bugs.UsersDB();<BR>db.DeleteUser(UserID);<BR>dgUsers.EditItemIndex=-1;<BR>Bind();<BR>}<BR>Figured it out. And its a good one! So disregard this thread.
 
Back
Top