EDIT & DELETE grid buttons don't work

R

Rudy

Hello all,
Going to make this short and sweet for now, need to dig myself out of a foot
of snow this morning. :( I have a data Grid, everything work well, except
for the button. Here is my error: "Index was out of range. Must be
non-negative and less than the size of the collection. Parameter name: index"
Source Error:


Line 275: ' if the user checked a box in a CheckBoxList control,
you could check to see
Line 276: ' if the value SelectedIndex property was > -1.)
Line 277:
DeleteItem(grdProducts.DataKeys(e.Item.ItemIndex).ToString)
Line 278: End If
Line 279:

I'm assuming the index would be my key column. I guess I don't really
understand how the index works.
If someone knows a good sample or HOW To, that would be great!

Thanks for the help!

Rudy
 
R

R. Thomas, aka Xtreme.Net

This is an article of how to delete rows from ur d
http://www.aspnetpro.com/newsletterarticle/2003/03/asp200303wf_l/asp200303wf_l.asp
See how they use index in this and you will get the concept of index..
Another one here : http://www.developerfusion.com/show/3801/5/
And another one that incorporates, edit,delte and paging into one article
here : http://www.c-sharpcorner.com/asp/Code/northwindLC.asp

Btw, the error means that the index that you are passing is our of range.
something like : if you have 6 objects and you are looking for the 7th
object..
Hth...

P.S : If this post helped you, Please click on the 'Yes' button on top of
this post. Thanks

R. Thomas
 
R

Rudy

Thanks Thomas,
Now that you explained what error means, I think I know what wrong. Thnks
for advice!!

Rudy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top