EDIT & DELETE grid buttons don't work

Discussion in 'ASP .Net Building Controls' started by Rudy, Jan 6, 2005.

  1. Rudy

    Rudy Guest

    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
     
    Rudy, Jan 6, 2005
    #1
    1. Advertising

  2. 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



    "Rudy" wrote:

    > 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. Thomas, aka Xtreme.Net, Jan 7, 2005
    #2
    1. Advertising

  3. Rudy

    Rudy Guest

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

    Rudy

    "R. Thomas, aka Xtreme.Net" wrote:

    > This is an article of how to delete rows from ur dg
    > 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
    >
    >
    >
    > "Rudy" wrote:
    >
    > > 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
    > >
     
    Rudy, Jan 7, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Moore [MSFT]

    RE: Q - About Edit and Delete buttons in DataGrid

    Mike Moore [MSFT], Oct 20, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    461
    Mike Moore [MSFT]
    Oct 20, 2003
  2. Kevin Frey
    Replies:
    3
    Views:
    1,138
    Kevin Frey
    Nov 27, 2006
  3. Andy B
    Replies:
    0
    Views:
    339
    Andy B
    May 21, 2008
  4. RH

    Change text of edit/update/delete buttons

    RH, Aug 22, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    127
    Stevie_mac
    Aug 22, 2003
  5. Ather Ali Shaikh

    Q. About Show and Hide Edit and Delete Buttons

    Ather Ali Shaikh, Oct 16, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    145
    Ather Ali Shaikh
    Oct 16, 2003
Loading...

Share This Page