Dynamic Data Conditionally Display Foreign Key Links

Posted on 2009-04-22
Last Modified: 2012-05-06
I am working on a Dynamic Data site and I have two separate pages to view a table (one that allows add/update/delete and one that is read only).  I need a good way to remove foreign key links on one of the pages, but retain the functionality on the other.

Please only examples in VB.NET.  I tried to get this solution in C# to work, even converting it, with no luck, but this is basically what I'm going for:
Question by:natek11
    1 Comment

    Accepted Solution

    This is how I got it to work, although I'm sure it's not the best way:
    1. Created a custom version of the ForeignKey.ascx field template with a label instead of a link
    2. Turned off autogeneratecolumns on the gridview of the read-only page
    3. Manually added all the fields as asp:DynamicFields
    4. Set the UIHint on the Foreign Key DynamicField to my custom field template

    Still open to suggestions on a better method...
    <asp:DynamicField DataField="Statement_Type" HeaderText="Statement Type" UIHint="ForeignKey_NoLink" />

    Open in new window


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now