Gridview not updating on edit
I am using a Paged Collection View or Observable Collection to bind data to Rad Grid View.
In this article we will look at how to update or delete a record in a database table using a Grid View control.
Then again we have to call that Bind Grid Data () method to bind data for the textboxes.
So once after done with editing data, if we click update the following method will be triggered. Once we access the required fields in the code behind, we need to update the data in the database and show the updated data to the user. If the user clicks the Delete button On Row Deleting event will be fired.
You can see the C# code below will give the row number whatever you are editing by New Edit Index property.
But after I update, the changes are not reflected in the Rad Grid View.
On click of the button, I am calling a Delegate Command to do the action.
I am passing the current row as the Command Parameter of that button.
To avoid this we need to keep the property Read Only as false, Then in the edit mode nothing will happenes. The reason I use Template Field instead of Bound Field is that, it is very easy to grab those controls in the codebehind if we user labels or textboxes.
In case of the bound field’s we need to check what column it is and need to use index of that cloumn, which is little hard and even in future if we change the column order If you see the Last Template Field part in the above code, I am using the link buttons for edit, update, delete and cancel.