locked
Order Foreign Key Column Appears in UI RRS feed

  • Question

  • User-287548267 posted

    Is there a way to set the order that a foreign key column appears in the UI?  For "normal" columns it's as simple as placing the following code in my metadata class: 

    Display(Order = 1)] 
    public object ColumnName { get; set; }

    However, applying attributes in this fasion seems to have no effect on foreign key columns.  I feel like I'm missing something very simple since this seems like a very common requirement.  Any help is greatly appreciated. Thanks!

    Tuesday, May 3, 2011 10:01 PM

Answers

  • User-526354650 posted

    It works. Just make sure you put the attribute on the navigation properties (i.e. Product) and not on the primitive foreign key properties (i.e. ProductID).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 4, 2011 9:22 AM

All replies

  • User1043796333 posted

     Display(Order = 1)]

    Missing bracket? [Display(Order = 1)]

    VS2010? Framework 4?

    Wednesday, May 4, 2011 1:30 AM
  • User-526354650 posted

    It works. Just make sure you put the attribute on the navigation properties (i.e. Product) and not on the primitive foreign key properties (i.e. ProductID).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 4, 2011 9:22 AM
  • User1043796333 posted

    To olegsych:

    When is your ASP.Net Dynamic Data Book going to be released? Do you cover Custom Field Templates "cascading"?

    I'm in big need with this issue and even tough Stephen Naughton has been doing a terrific job trying to solve this part of the equation on his own

    Truth is that he goes through a lot of circles in order to build the cascade, call it dependencies: older-ancestor, father, son, grand-son, etc. and he does marvelously but there should be a better VS2010 tool available to do this more expedite

    I’m not saying that he is doing anything wrong.

    On the contrary, he is trying to suffice something that is insufficient in VS2010 Dynamic Data but his approach is limited to what he thinks a solution might be, even though he tries to make his whole solution generic and he does simply great

    Congratulations Stephen Naughton, you are the man, you’re my hero in Dynamic Data

    What I think is that Visual Studio should provide intrinsic classes for doing this but unfortunately the documents on ASP.Net Dynamic Data are outdated, hard to understand, not focused on reality, unprofessionally elaborated

    You don’t find anywhere in an MSDN document the way in which Dynamic Data works but a set of layered images that show nothing more than generalities of its architecture in a very shallow manner

    But if you want to see how the whole set of machinery works, call it its classes, and the way in which Dynamic Data accomplishes all of its spinning logic, then you got nothing of information

    For instance, if you put a flag or instruction after an OnSelectedIndexChanged trying to pass a value to another control in your FormView then you’ll find out, in debug mode, that Dynamic Data does a lot of work before executing the OnSelectedIndexChanged, which comes at last, so all the values you’re trying to pass are simply “NULLs”

    PLEASE, HELP!

     

     

    Wednesday, May 4, 2011 11:03 AM
  • User-526354650 posted

    The rough cuts of the first chapters will be available on Safari Books Online in the next few weeks. The book should be coming out later this year, but I can't be more specific at this point. The topic of interaction between field templates will be covered in the book.

    Thursday, May 5, 2011 4:26 PM