i m retrieving values from database using datagrid and i want to update the database using that similar datagrid but somehow i m having trouble, can anyone guide me how to do that.....
i mean when the query is executed and selected data is retrieved if the user wants to update something he/she can do it at the datagrid in which value is being displayed.... there are really many ways to work with data and in a lot of times it is a developer preference to work one way or another.
Assuming that you have the row index to modify in variable Data Table vehicle = data Source.
Then to notify when I change a property within the entity in an observable collection, I've used a notify property within the as an example. I think yours is slightly different, but they overlap on the concepts. Observable Collection Notify when property changed in MVVM EDIT If the datagrid is sorted the previous method will not update the grid.
There's a couple of major design changes to you're code.
First, I'm using a straight property for my Observable Collection.
For context here is the File Table member in my View Model: I don't define the columns because I don't know how many there are .... In my View Model I have an observable collection of this object.
I have an observable collection in the view model that implements Bindable Base as follows Please have a look at the Move Up and Move Down methods where they are bound to two buttons in the view. I have some cs code as well for the both up and down buttons specified below the viewmodel.
Also, I have no knowledge if a separate Data Table is linked (i.e. Making a change to the Data Table may or may not translate to changing the data stored in the Data Grid View. NOTE to Above: I do not have VS running, so I'm not sure if that code is 100% accurate, but it should give you the idea.