Click here to Skip to main content
15,915,752 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I created a Datatable and bind with Gridview. now i delete a row from gridview and again bind with Gridview its not working its working with only when i delete last row


Solution ???
Posted
Comments
Azee 3-Oct-13 1:20am    
Could you post your code where you delete the row?
Thanks7872 3-Oct-13 1:22am    
Solution ???

its not working

whats this? Do we suppose to assume the code you have implemented?
You should delete that from the DataSource. If you are getting data from Database, then you have to delete it from the Database Table also.
VICK 3-Oct-13 3:06am    
store the datatable which you are binding with gridview in ViewState.... then get the index of the row which you want to delete and than delete the row of DataTable on that index... than resave the remaining datatable in viewstate and rebind gridview with that datatable... in this way you can do what you want.

1 solution

Don't do that way. Delete row from Datatable[^] & rebind the GridView with changed DataTable.
And a comparison Difference between DataRow.Delete and DataTable.Rows.Remove Methods[^]
 
Share this answer
 

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