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 ?
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.
You can simply rebind your gridview with new datatable that has some of these rows deleted by you.
Helping you always. Don't forget to click "Mark as Answer" on the post that helped you.
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠
Member
231 Points
905 Posts
How can i delete rows in a Grid by traversing ?
May 10, 2019 06:45 AM|robby32|LINK
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
Participant
1300 Points
522 Posts
Re: How can i delete rows in a Grid by traversing ?
May 10, 2019 09:36 AM|Wei Zhang|LINK
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
Member
231 Points
905 Posts
Re: How can i delete rows in a Grid by traversing ?
May 21, 2019 03:55 AM|robby32|LINK
Hi ,
I have done a work around
thanks
Participant
1060 Points
732 Posts
Re: How can i delete rows in a Grid by traversing ?
May 31, 2019 12:20 PM|yogyogi|LINK
You can simply rebind your gridview with new datatable that has some of these rows deleted by you.
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠