EDIT & DELETE grid buttons don't work

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default EDIT & DELETE grid buttons don't work

    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 Guest

  2. Similar Questions and Discussions

    1. Checkboxes in grid/delete row not working
      I copied the code for this direclty from http://www.asfusion.com/blog, but for some reason when I go to delete a row in the grid, it merely leaves...
    2. How to edit records in a grid that's within a grid
      I am having a heck of a time getting a child grid (a grid within a grid) to go into edit mode. My code is below; it will go into edit mode only...
    3. Q. About Show and Hide Edit and Delete Buttons
      hi, I am using a datareader to assign to the datagrid in my ASP.Net Page using VB.Net I have stored procedure to retrieve the data. In the...
    4. Buttons on grid
      Hi How can I place a push button on each row of a grid? Thanks Regards
    5. Change text of edit/update/delete buttons
      Hi, I Have a datagrid with edit/update/delete hyperlink buttons and would like to change the text of these buttons during runtime. How can I do...
  3. #2

    Default RE: EDIT & DELETE grid buttons don't work

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

    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 Guest

  4. #3

    Default RE: EDIT & DELETE grid buttons don't work

    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
    > [url]http://www.aspnetpro.com/newsletterarticle/2003/03/asp200303wf_l/asp200303wf_l.asp[/url]
    > See how they use index in this and you will get the concept of index..
    > Another one here : [url]http://www.developerfusion.com/show/3801/5/[/url]
    > And another one that incorporates, edit,delte and paging into one article
    > here : [url]http://www.c-sharpcorner.com/asp/Code/northwindLC.asp[/url]
    >
    > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139