I'm trying to get the hang of using Entity Data Sources and have created a simple database consisting of the two tables
Manufacturer
============
ManufacturerId (int)
NanufactureName (varchar)
Software
=========
SoftwareId (int)
ManufacturerId (int)
SoftwareName (varchar)
The two tables link on ManufacturerId
Ive created a EDS for these and a dropdownlist listing manufacturers using a EntityDataSource (which gets the manufacture table) and a Gridview using the EntityDataSource which uses the EDS to get software table.
The Gridview has edit/delete (so needs to use the Software table as its source) and Ive managed to bind a dropdown in the editTemplate of this to the ManufacturerId whilst getting the list from the ManufactureDataSource so that when people select edit it shows a dropdown list of manufacturers with the one corresponding to the ManufacturerId in the software list selected - this works fine and they can change and update this.
My problem is in the ItemTemplate I want the label to show the Manufacturer name, not the manufacturerId, but I cant figure how to do this. The label control cannot be linked to a different datasource (as far as I can see). If I use a view or stored procedure as the datasource (ie making a view in which the two tables are inner joined so it returns the manufacturer name) I cannot do updates, inserts etc in the gridview as it would try updating the view and not the software table
Could anyone please advise me how to get round this in EntityDataModels. I have managed with ObjectDataSourceModels and SQLdataSourceModels but cannot see anyway of doing this with EntityModels, as each entity corresponds to a table.
Thanks
Andy
Manufacturer
============
ManufacturerId (int)
NanufactureName (varchar)
Software
=========
SoftwareId (int)
ManufacturerId (int)
SoftwareName (varchar)
The two tables link on ManufacturerId
Ive created a EDS for these and a dropdownlist listing manufacturers using a EntityDataSource (which gets the manufacture table) and a Gridview using the EntityDataSource which uses the EDS to get software table.
The Gridview has edit/delete (so needs to use the Software table as its source) and Ive managed to bind a dropdown in the editTemplate of this to the ManufacturerId whilst getting the list from the ManufactureDataSource so that when people select edit it shows a dropdown list of manufacturers with the one corresponding to the ManufacturerId in the software list selected - this works fine and they can change and update this.
My problem is in the ItemTemplate I want the label to show the Manufacturer name, not the manufacturerId, but I cant figure how to do this. The label control cannot be linked to a different datasource (as far as I can see). If I use a view or stored procedure as the datasource (ie making a view in which the two tables are inner joined so it returns the manufacturer name) I cannot do updates, inserts etc in the gridview as it would try updating the view and not the software table
Could anyone please advise me how to get round this in EntityDataModels. I have managed with ObjectDataSourceModels and SQLdataSourceModels but cannot see anyway of doing this with EntityModels, as each entity corresponds to a table.
Thanks
Andy