Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 29, 2012 02:10 PM by devouree
Nov 28, 2012 10:21 PM|LINK
I'm wondering if it's possible to use the ForignKey template on a DynamicField in a standard data bound GridView in an non Dynamic Data website.
I tried using the Order Details table from Northwind. I get other dynamic data fields to work (integer, date time), but when I try to use the ForeignKey UIHint, I see this error: 'Order' is not a foreign key column and cannot be used here.
I imported all of the Field Templates from a dynamic data project
Should I expect that this should work and am I just doing something wrong? Or does this not work outside of an actual Dynamic Data website?
I'm using .NET 4.5, EF 5.0, IIS Express.
Here's my code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="OrderID,ProductID" DataSourceID="EntityDataSource1">
<asp:DynamicField DataField="Order" HeaderText="Order" UIHint="ForeignKey" />
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=NorthwindEntities" DefaultContainerName="NorthwindEntities" EntitySetName="Order_Details" Include="Order"/>
Nov 28, 2012 11:08 PM|LINK
Hi devouree, this is not supported sorry :(
Nov 29, 2012 07:01 AM|LINK
in an non Dynamic Data website.
No, Dynamic Data Controls can be only used in Dynamic Data website. If you insist using Foreign Key, I think you can use nested GridView or something related to that to show One-To-Many：
Nov 29, 2012 02:10 PM|LINK