Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello mentors,

I am using the Gridview control in asp.net.I am using checkboxes to delete multiple rows at a time.

Previously i was using the following code to delete rows(one at a time) in GridView_RowDeleting event

Datatable.Rows.RemoveAt(index)
Datatable.AcceptChanges()



//after that i was binding the grid again to the updated datatable


GridView.DataSource = Datatable
GridView.DataBind()

here index is the index of the row i was deleting and dtInboxData.Rows.RemoveAt(0)datatable is my datatable associated with the gridview.

Now i want to delete multiple rows using the same and i am looping around the selected rowindexes to call the same

For iCount = 0 To asRwIndexes.Length - 1

'remove from grid
Datatable.Rows.RemoveAt(asRwIndexes(iCount) - 2)
Next

But this code is removing the row from datatable but not rendering in the HTML of the Gridview.Ex- The row is removed from the Datatable but its still visible in the
ASPX of my page where Grid is rendering.


PS: I am using Ajax call to call this.Please suggest.
Posted
Comments
Christian Graus 8-Jan-13 3:15am    
I bet you're not using AJAX at all, you're using the ASP.NET AJAX library. Either way, you need to post your code if you want us to fix it
gouravkaila 8-Jan-13 4:05am    
I am using Ajax toolkit and my Grid view is placed in update panel.
What i have to do is that i want to delete the rows of InboxGrid.aspx(which contains the Gridview Control with checkboxes) from the clientside buttonclick of another page(Headerpage where i am collecting the indexes of selected checkboxes). And i want remove the rows from InboxGrid.aspx at runtime also.So i am sending an Ajax call from the clientclick of button in Header.aspx. I am posting the whole code below.Thanks a lot in advance.. :)
Christian Graus 8-Jan-13 4:09am    
Please edit your post, so we can read your code.
gouravkaila 8-Jan-13 4:18am    
Please find the whole code below.

 
Share this answer
 
Comments
Christian Graus 8-Jan-13 4:08am    
His issue is the ASP.NET AJAX library.
hi dear

Please try to define trigger if you are using update panel.
 
Share this answer
 
Comments
Christian Graus 8-Jan-13 4:07am    
What ? How does that help ?
gouravkaila 8-Jan-13 4:30am    
Please elaborate.I doubt if there is some relation of this issue with update panel triggers
Mr. Mahesh Patel 8-Jan-13 7:29am    
trigger will help to postback the page and executing the code which is placed in update panel.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900