locked
How can i delete rows in a Grid by traversing ? RRS feed

  • Question

  • User1253338400 posted

    Hi , 

    I have a Grid with the command buttons , edit and delete. Now I am traversing the grid and fining the dlete command button and causing a click event .

    The issue is if I use something like 

    for(int i=0; i<grirow.count; i++), this wont work because if I started with 15 rows and lets say the second is deleted , then I dont have 15 any more I have 14 , but the loop is set to loop around 15 times and the indexer , i , wont increment..

    Is there a way I can traverse and cause a  delete  ? or do I have to keep a record of where the index is and continue from there ?

    Thanks

    Friday, May 10, 2019 6:45 AM

Answers

  • User-2054057000 posted

    You can simply rebind your gridview with new datatable that has some of these rows deleted by you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 31, 2019 12:20 PM

All replies

  • User-1174608757 posted

    Hi robby32,

    According to your description, I couldn't understand your requirement clearly.So,I hope that you could give me more details about what you want to and what problem you met.It will help us to solve your problem. 

    Best Regards

    Wei

    Friday, May 10, 2019 9:36 AM
  • User1253338400 posted

    Hi ,

    I have done a work around

    thanks

    Tuesday, May 21, 2019 3:55 AM
  • User-2054057000 posted

    You can simply rebind your gridview with new datatable that has some of these rows deleted by you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 31, 2019 12:20 PM