This is a migrated thread and some comments may be shown as answers.

Checking for changed data with template columns in RadGrid

2 Answers 240 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pooja
Top achievements
Rank 1
Pooja asked on 13 Feb 2013, 04:19 PM
Hello,

Here is what I am trying to achieve. I have a grid which consists of Template columns and I use entity framework to make updates.
The gird will always have one row and the row is in editable mode at all times. Along with the grid I have couple of other controls and another grid on the same page. And I am using an external Save button to save my changes.

Now I dont want to save the Grid Data if the row data was not changed at all. I have tried using
ExtractValuesFromItem
and SavedOldValues. Both of them return nulls. Also I am using Bind and NeedDataSource as suggested in various posts. 
I am left with following options :
1) Change the entity framework resultset to a Dataset and add that dataset as a public property and use
Dim changedRows As DataRow() = ordersTable.Select("OrderID = " + editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("OrderID").ToString()

2) Add the OntextChanged event and then do some javascript.


Questions:
Q1 What is the best way of detecting changes and are there any other alternatives?
Q2 Is ther anything that I am missing in my current method of ExtractValuesFrom Item?

Please help. I have gone through numerous threads and downloaded many samples. They work but does not fit into my requirement.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 14 Feb 2013, 04:50 AM
Hi Pooja,

If you have a GridTemplateColumn with a custom EditItemTemplate and controls you are creating inside it, you cannot use the ExtractValuesFromItem() method, as this method works only for auto-generated column editors. One option is, you can use the TextChanged event to detect changes as discussed in this forum thread.

Thanks,
Shinu.
0
Pooja
Top achievements
Rank 1
answered on 14 Feb 2013, 08:50 PM
Thanks a lot Shinu. This is exactly what I was looking for.

Regards
Tags
Grid
Asked by
Pooja
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Pooja
Top achievements
Rank 1
Share this question
or