Updating a datagrid

26 Apr

In the other window, when the user clicks on "Save", I create a row programatically and add it using "Insert On Submit". The least terrifying way to fix this, is to copy your LINQ-to-SQL results to an Observable Collection - when you do the Insert, also add to the observable collection. @Memory Leak - so here's the tricky bit; not only do you want to know when the collection changes (i.e.

After that I use the Data Context's "Submit Changes" method. If I restart the application I can see the new row, so it's in the database, but I couldn't find a way to refresh the Data Grid. what INotify Collection Changed), you also want to know when any of the items change.

Here is the basic idea of our sample application; we would have sample data with one property that can be selected from a list of values displayed in Combo Box.So I have to specify how I want them to appear in the normal view and edit view.That’s why I have placed different templates like Item Template (for normal view) and Edit Item Template (for edit view).The following figures will clarify what I have done:......It seems we are done with the design of our Data Grid columns.The Data Context's won't properly recognize the new row even after a submit changes.You need to dispose the Data Context you have and create a new one.So far I've tried to use "Update Target" on the Binding Expression of the Data Grid, but it didn't help. So you need to subscribe to the collection change, then on add/remove, subscribe to each item's INotify Property Changed.Then you have to decide what to save based on which notifications you're getting Thank you :) I tried rebinding the same source but it did not update the data. I ran into same problem and found that best place for Observable Collection is Data Context.I have specified Data Key Names as Auto ID, the primary key of the database table.Then I have several methods attached with following events Get video of hundreds of ASP. On Row Editing - Edit Record On Row Cancel Edit - Cancel Record On Row Updating - Update Record On Row Deleting - Delete Record As I set Auto Generate Columns property to false so I am going to manually write the fields name that I need to appear in the way I want.