Last post Oct 14, 2010 07:46 PM by sjnaughton
Oct 14, 2010 09:12 AM|TEE_7|LINK
I am using a DynamicData - Entity project. I have added a DynamicDataManager with AutoForeignKeys = true and also added a EntityDataSource with an include to the associated table.
<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" >
<asp:DataControlReference ControlID="gvContact" />
<asp:EntityDataSource ID="EDS1" runat="server"
The contacts table has many to one relationship with the Ref_Values and Ref_States table were it shoud retrieve a "text" value for the job title and state.
When the page is ran the gridview returns the integer value that is in the DonorContacts table not the foreign key value.
I have ensured that the relationship exist and that all tables have a primary key. Also if I set the scaffold to true in the global.asax file and view the DonorContacts table the columns in question display the expected data, not the int.
I can get the correct value by using <%#Eval("Ref_Values.Ref_Desc")%> but no other way.
This line displays a 1
<asp:DynamicField DataField="Donor_Contact_Id" HeaderText = "Type" >
This line displays Engineer
<asp:TemplateField HeaderText="Type" <ItemTemplate >
ASP.NET Dynamic Data
Foreign key Fields
Oct 14, 2010 11:23 AM|klca|LINK
This is obviously not an answer but I have had the same problem so did Mr. Yossu.
It seems that Mr. Ebbo has already given some kind of solutions to this topic in prior posts so you better look at them so you might probably get an answer.
Note: I decided not to go ahead with the WCF RIA Services because it is alll brand new and just makes more complicated things to me as they are right now with my lack of understanding on how to carry on data while bulk inserting and also in creating
cascading for dropdownlists (at template level not customizaing every single page)
Carlos Porras (El Salvador)
Oct 14, 2010 07:46 PM|sjnaughton|LINK
Hi Tee_7, it looks to me like you are using
to enable Dynamic Data on your custom page, you will not get the nice foreign key relationships this way, have a look at my old Custom Pages articles here Part 1 - Standard
Custom Page Dynamic Data and Custom Pages they are a little out of date for DD4 but they should point you in the right direction especially if you start with one of the page templates to begin with.