I understand that this attribute should be set in my Model.Designer.cs, before the partial class declaration. How ever this will be overridden when the model is updated at some poing of time.. How do we handle it?
I understand that this attribute should be set in my Model.Designer.cs, before the partial class declaration. How ever this will be overridden when the model is updated at some poing of time.. How do we handle it?
you cannot add this to the designer file as this is autogenerated code you need abuddy class see
8. Using ASP.NET Dynamic Data
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: Issue in display of foreign key column when Scaffolding is enabled
Mar 20, 2012 07:14 PM|LINK
in that case you need to use the DisplayColumn attribute on the FK table to indicate which column to display it uses the format
[DisplayColumn("ColumnToDisplay", "ColumnToSortBy", true)]
if last parameter is set to true (it is optional) the sort applied os descending
Always seeking an elegant solution.
nancy1985
Member
14 Points
11 Posts
Re: Issue in display of foreign key column when Scaffolding is enabled
Mar 20, 2012 07:20 PM|LINK
Could you please explain me in detail again? Where should this attribute be set?
nancy1985
Member
14 Points
11 Posts
Re: Issue in display of foreign key column when Scaffolding is enabled
Mar 20, 2012 07:34 PM|LINK
I understand that this attribute should be set in my Model.Designer.cs, before the partial class declaration. How ever this will be overridden when the model is updated at some poing of time.. How do we handle it?
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: Issue in display of foreign key column when Scaffolding is enabled
Mar 20, 2012 07:42 PM|LINK
Always seeking an elegant solution.