Last post Jan 27, 2009 09:38 AM by sjnaughton
Jan 26, 2009 04:24 PM|defyant_2004|LINK
Is it possible to continue displaying the values of a navigation field ( fk field ) but to disable the naviation/hyperlink when displaying records from a related table?
Jan 26, 2009 05:24 PM|ricka6|LINK
The easiest thing to do is annotate the FK entity partial class with ScaffoldTable(false). That will prevent all indirect (via links in related tables) and direct access.
Jan 26, 2009 05:35 PM|defyant_2004|LINK
Just to make sure I understand -- when I do that -- I will no longer be able to access that table using the Dynamic Data.
Is there any other way to prevent losing that tables data management functionality?
Jan 26, 2009 05:59 PM|ricka6|LINK
you are correct - that entity will be removed from the Scaffold. This is generally (but not always) what you want to do when you have the need to disable URLs to the related entity.
You could use UIHint on the column to specify Text instead of the default ForeignKey.ascx control. The FK control is a NavigateUrl control
Stephen will probably have a good metaData approach to set AllowNavigation to false.
Jan 26, 2009 06:04 PM|ricka6|LINK
This question came up recently. See
Jan 27, 2009 09:31 AM|defyant_2004|LINK
Thank you. If it becomes a need, I will try creating a new foreign key user control and removing the hyperlink functionality.
Jan 27, 2009 09:38 AM|sjnaughton|LINK
Here's my article
Disallow Navigation on ForeignKey FieldTemplate – Dynamic Data it may make it a little easyer that a new FieldTemplate.