Home/ASP.NET Forums/General ASP.NET/Data Scaffolding using ASP.NET Dynamic Data/How to Sort my objects in Dynamic Data?

How to Sort my objects in Dynamic Data? RSS

16 replies

Last post Nov 30, 2009 07:51 PM by CrowSol

~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
Shakti Singh Tanwar
.Net Trainer (MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])
  • sjnaughton

    sjnaughton

    All-Star

    27330 Points

    5459 Posts

    MVP

    Re: How to Sort my objects in Dynamic Data?

    Aug 29, 2009 11:48 AM|LINK

     Hi Dynamic2008, I don't think that is possible with DD v1 you could do it with a custom filter in DD Preview 4, the only sort ability come from the DisplayColumn attribute like [DisplayColumn("DisplayColumnName","SortColumnName", false)] the final property set the sort to decending if set to true. So for DD v1 you can only set a single column to be sorted on.

    Dynamic Data

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • Dynamic2008

    Dynamic2008

    Member

    127 Points

    164 Posts

    Re: How to Sort my objects in Dynamic Data?

    Aug 29, 2009 05:01 PM|LINK

    Ah, that's bad to hear.

    Why ASP.NET dynamic data simply doesn't generate application layers (e.g. Data Access, Business Logic and UI) so that they can be used seperately. What are the requirements for DD Preview 4? .NET 4.0?

    If it needs .NET 4.0 I won't be able to use it.

    Do you know of any other good data entry solution?

    I think maybe best is to create an application myself which simply generates the layers for me, etc.

    I have heard of TierDeveloper which is free; I may try that before developing an app myself.

    Seek and you will find!
  • Shakti Singh Tanwar

    Shakti Singh...

    Star

    10870 Points

    1827 Posts

    Re: How to Sort my objects in Dynamic Data?

    Aug 29, 2009 05:59 PM|LINK

     Have you tried my solution?

    ~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
    Shakti Singh Tanwar
    .Net Trainer (MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])
  • Dynamic2008

    Dynamic2008

    Member

    127 Points

    164 Posts

    Re: How to Sort my objects in Dynamic Data?

    Aug 29, 2009 07:14 PM|LINK

    Shakti,

    I believe that's not a solution.

    That linq statement returns only one row anyway, so there i no point in ordering that.

    Instead of First() maybe I should have written Single() to be more clear.

    Thanks,

    Seek and you will find!
  • sjnaughton

    sjnaughton

    All-Star

    27330 Points

    5459 Posts

    MVP

    Re: How to Sort my objects in Dynamic Data?

    Aug 29, 2009 11:13 PM|LINK

    Dynamic2008

    Why ASP.NET dynamic data simply doesn't generate application layers (e.g. Data Access, Business Logic and UI) so that they can be used seperately. What are the requirements for DD Preview 4? .NET 4.0?

    If it needs .NET 4.0 I won't be able to use it.

    You need the 99.0.0.0 assemblies that come in the common files folder [:(] you could always use the bits from the old Futures project which had all the source code and use the filter repeater and just written custom filters see: Dynamic Data Futures VS2008 SP1 RTM it this does not have the full source anylonger I have a copy [;)]

    Dynamic Data filters

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • Dynamic2008

    Dynamic2008

    Member

    127 Points

    164 Posts

    Re: How to Sort my objects in Dynamic Data?

    Aug 30, 2009 06:25 AM|LINK

    Thanks I will look into that.

    A potential solution: just an idea cam to me when I was asleep that if second parameter (SortColumn) of DisplayColumn attribute needs an existing property to be able to sort the results what I might be able to do is to add a new property to my class such as "ReportRoleDisplay" and put the logic I wrote for ToString() inside its get{} statement. Then I will set the SortColumn to be the name of the new property. It may work!

    I will try that on Tuesday; now enjoying my last summer bank holiday ;)




    Seek and you will find!
  • sjnaughton

    sjnaughton

    All-Star

    27330 Points

    5459 Posts

    MVP

    Re: How to Sort my objects in Dynamic Data?

    Aug 30, 2009 10:55 AM|LINK

     Good Idea I did something like this in a recent project we created a calculated column that just concatenated the two columns we wanted to sort on and used them as the display column. [:D]

    Dynamic Data Calculated Column Sort Column

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • sjnaughton

    sjnaughton

    All-Star

    27330 Points

    5459 Posts

    MVP

    Re: How to Sort my objects in Dynamic Data?

    Aug 31, 2009 09:37 AM|LINK

    Dynamic2008

    I might be able to do is to add a new property to my class such as "ReportRoleDisplay" and put the logic I wrote for ToString() inside its get{} statement. Then I will set the SortColumn to be the name of the new property. It may work!
     

    It wont work as the property does not exist in the DB [:(]

    Dynamic Data Sort Filters

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • Prev Next
    1 2Last

    ‹ Previous Thread|Next Thread ›