Linq submitchanges not updating database
The easiest way to-do this is by selecting the “Configure Data Source” option in the Grid View smart task: This will bring me back to the control’s design-time UI that we used at the very beginning of this tutorial.
For example: When I run the page I’ll now get a filter dropdownlist of all categories at the top of the page: My last step is to configure the Grid View to only show those Products in the category the end-user selects from the dropdownlist.
We’ll begin working on the application by first defining the data model we’ll use to represent our database.
I discussed how to create a LINQ to SQL data model using VS 2008’s LINQ to SQL designer in Part 2 of this series.
In the source code below I’m going to take advantage of the fact that each Product class in the LINQ to SQL data model we created has a Supplier and Category property on it.
What this means is that I can easily databind their Supplier. Category Name sub-properties within our Grid: And now when I run the application I get the human readable Category and Supplier name values instead: To get drop-down list UI for the Supplier and Category columns while in Edit-Mode in the Grid, I will first add two additional columns we added to our Grid View earlier and customize their edit appearance (by specifying an Edit Item Template).
For example, we could remove the “Quantity Per Unit” column below and re-run our application to get this slightly cleaner UI: If you have used the control before and explicitly passed update parameters to update methods (the default when using Data Set based Table Adapters) one of the things you know can be painful is that you have to change the method signatures of your Table Adapter’s update methods when the parameters based by your UI are modified.