Last post Dec 14, 2017 11:39 AM by Eric Du
Dec 04, 2017 06:37 PM|sevi|LINK
With a gridview bound to a sqldatasource, I update a row using a formview on the same page; I don't edit in the gridview itself. I want to update the gridview row for the record just changed by the formview. I don't want to rebind the entire gridview because
that invokes whatever sort is applied and the updated row might end up on a completely different page of the grid.
So, is there a way to update the text that is displayed in a single row of a bound gridview control "in place" without refreshing the entire gridview? Something like, find the row in the gridview and update the text value for the column that has been changed?
Dec 05, 2017 02:30 AM|Eric Du|LINK
According to your description and needs, this needs could be achieved through the following steps:
1. Show the selected row value in the formview from the gridview(You could use textbox to replace the td in formview, then add a button to save data).
Display (Show) GridView Selected Row in FormView control in ASP.Net using C# and VB.Net:
2. You say don't want to refresh the entire page when load the new data, i think you could use jQuery AJAX to access data and load it without refresh page:
Bind data to GridView with jQuery or JSON in ASP.Net:
Dec 05, 2017 03:15 AM|sevi|LINK
The first item you list is not an issue, I have that in place.
For the second item, refreshing the grid, is there really no other way than to bind using jquery or json? That's going to be more than I wanted to do. No way to simply update the text in a single row?
Dec 12, 2017 09:58 AM|Eric Du|LINK
According to your needs, i think you could this method, when you click update button in formview, update this record in the database, if update success, then return true or false from the code behind, if update success, find this line record, then replace
Dec 12, 2017 04:14 PM|sevi|LINK
Eric, what I am looking for is the method of "replace the text". How does one do that? What you've done is to repeat what my goal is. I want to know how to implement the gridview text replacement, as my own experiments have not been successful.
Dec 14, 2017 11:39 AM|Eric Du|LINK
According to your needs, you could use jquery to achieve this, the gridview will be read as table in browser, so you cold check this tutorial:
Using Jquery, replace one row in table with a new one: