Hello Team;
Let me first provide some info, before discussing my problem.
Previously I had used EF and "ObjectCondext" for my Model. Then for each ASP Page that I needed DataSource, I had used ObjectDataSource (ODS). In the ODS declaration, I had identified the "Update" method which takes two parameters. One the modified object and the second the Original object.
In the Update method first I would attach the Original object to my ObjectContext first and the call "ApplyCurrentValues" Method from ObjectContext and pass the modified object. This method would then compare the properties between the two objects and create the proper SQL update command to update only Modified properties.
Now, with this new project, I'm using CodeFirst and DbContext and unfortunately DBContext does not have "ApplyCurrentValues" Method to pass two objects (before & after). It only takes the modified object.
But I'm running into a serious problem with Telerik Grid in this situation. Let's say I have a customer object with 20 properties and three Foreign key properties. If I connect the Grid to ObjectDataSource and have only 5 properties as "Editable" in the grid, when I do an update, the grid returns me an object with all the properties, but all the other 15 properties that were not editable and bound to TextBox (with Bind), they all become Null, including all my Foreign key fields.
In most cases, I don't need to have all the properties shown, Especially the foreign key values.
How do I solve this problem, that the grid returns me the original values of those properties that were not changed?
..Ben
Let me first provide some info, before discussing my problem.
Previously I had used EF and "ObjectCondext" for my Model. Then for each ASP Page that I needed DataSource, I had used ObjectDataSource (ODS). In the ODS declaration, I had identified the "Update" method which takes two parameters. One the modified object and the second the Original object.
In the Update method first I would attach the Original object to my ObjectContext first and the call "ApplyCurrentValues" Method from ObjectContext and pass the modified object. This method would then compare the properties between the two objects and create the proper SQL update command to update only Modified properties.
Now, with this new project, I'm using CodeFirst and DbContext and unfortunately DBContext does not have "ApplyCurrentValues" Method to pass two objects (before & after). It only takes the modified object.
But I'm running into a serious problem with Telerik Grid in this situation. Let's say I have a customer object with 20 properties and three Foreign key properties. If I connect the Grid to ObjectDataSource and have only 5 properties as "Editable" in the grid, when I do an update, the grid returns me an object with all the properties, but all the other 15 properties that were not editable and bound to TextBox (with Bind), they all become Null, including all my Foreign key fields.
In most cases, I don't need to have all the properties shown, Especially the foreign key values.
How do I solve this problem, that the grid returns me the original values of those properties that were not changed?
..Ben