locked
FilterRepeater Order Alphabetically RRS feed

  • Question

  • User-1254308814 posted

    I have a project column that is a filter. There are a lot of projects so I need an order by description to show up in the dropdownlist filter so it is easier to find the correct project that needs to be filtered by.

     

    Monday, November 3, 2008 4:10 PM

Answers

  • User1641955678 posted

    The way to do this is to add a DisplayColumn attribute to your Project entity.  e.g. 

        [DisplayColumn("ProjectName", "ProjectName")]
        public partial class Project {

    The first param is what's used for the display string, and the second is what's used for ordering.  They can be the same, as is the case here.

    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 5, 2008 6:56 PM

All replies

  • User-1005219520 posted

    The ASP.NET Dynamic Data 4.0 Preview 1   sample (Application DynamicDataWebForms.zip  )  ( if you want to use the preview bits) and the old futures sample (if you want to use the current bits) both contain a sample to specify the filter via the FilterAttribute . One possible approach would be to  reorder the elements after the  PopulateListControl(DropDownList1);  call in the Filter User control. 

    My blog http://blogs.msdn.com/rickandy/archive/2008/09/25/tweaking-the-filter-repeater.aspx takes this approach.

    Monday, November 3, 2008 6:43 PM
  • User-330204900 posted

    I have a project column that is a filter. There are a lot of projects so I need an order by description to show up in the dropdownlist filter so it is easier to find the correct project that needs to be filtered by.

    Do you want to show two things in the filter i.e. the project and the description? or do you want to order the Project column by the description?

    Tuesday, November 4, 2008 3:58 AM
  • User1641955678 posted

    The way to do this is to add a DisplayColumn attribute to your Project entity.  e.g. 

        [DisplayColumn("ProjectName", "ProjectName")]
        public partial class Project {

    The first param is what's used for the display string, and the second is what's used for ordering.  They can be the same, as is the case here.

    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 5, 2008 6:56 PM