Click here to Skip to main content
15,888,234 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datagrid where am adding some orders to the grid.Initially the grid can contain zero or more orders.
Now when the user does some modifications then on click of exit button, the user should display an alert message. i have already added an alert message.

so how to implement the logic to check whether any modification is done in the grid.

.
Posted

1 solution

If you are using an Array, (I recomend that you do), to hold the data when you populate the datagrid, you can just simply check if the values are the same.

You can simply do something like this:
C#
if (newDatagridValue != OldDatagridValue)
{
    databaseField = newDatagridValue;
}

(this is ofcourse pseudocode to show you what I mean, and not usable)

So if the Array holding the information you have presented is compared to a new array, that is made when you hit the "exit" button, you can see if it has changed and rewrite your data-source to reflect your changes.

-Frank
 
Share this answer
 
Comments
Member 10593922 23-Feb-14 23:24pm    
am using observable collection
Frank R. Haugen 24-Feb-14 6:52am    
I thought Observable Collection had this built-in (checking for changes that is)
http://msdn.microsoft.com/en-us/library/ms668604%28v=vs.110%29.aspx

Frank R. Haugen 24-Feb-14 6:56am    
AND: http://www.codeproject.com/Articles/47914/Working-with-ObservableCollection-T

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