locked
dynamic data project sorting RRS feed

  • Question

  • User-1471881183 posted

    hi all,

    i have created dynamic data project web application. its working fine. at one situation the foregin key values are showing in DropDownList, there i want to sort the data and then show on Dropdwonlist, I know that, to sort then use DisplayColumn but, i dont know how to use it, may i know how to sort it? 

    experts please help me.

    Saturday, August 10, 2013 12:54 AM

Answers

  • User-1471881183 posted

    finally, i got resolved 

    i put this code

    [DisplayColumn("company_name", "company_name", false)]

    on top of public partial class Table1: INotifyPropertyChanging, INotifyPropertyChanged

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 11, 2013 1:37 AM

All replies

  • User-330204900 posted

    Hi winseealn@ho..., this is fixed byt using the DisplayAttribute on the table you would use

    [Display("<ColumnNameTodisplay>","<ColumnNameToSortBy>")]

    Note: you put the actual column names int he quotes :)

    Saturday, August 10, 2013 6:32 AM
  • User-1471881183 posted

    thanks for your response.

    if i put just this single line [Display("<ColumnNameTodisplay>","<ColumnNameToSortBy>")] then will it work or have to adjust some more code?

    Saturday, August 10, 2013 6:44 AM
  • User-1471881183 posted

    i tried ur code but, getting below error

    Error 4 'System.ComponentModel.DataAnnotations.DisplayAttribute' does not contain a constructor that takes 2 arguments ......

    Saturday, August 10, 2013 6:47 AM
  • User-330204900 posted

    Sorry my Bad its DisplayColumnAttribute Embarassed oh the same Laughing

    Saturday, August 10, 2013 7:13 AM
  • User-1471881183 posted

    i dont understand, please tell me what code i have to use? and whee i have to put it?

    Saturday, August 10, 2013 7:35 AM
  • User-1471881183 posted

    finally, i got resolved 

    i put this code

    [DisplayColumn("company_name", "company_name", false)]

    on top of public partial class Table1: INotifyPropertyChanging, INotifyPropertyChanged

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 11, 2013 1:37 AM
  • User-330204900 posted

    That last false is optional you only set it to true if you want the sort order to be descending instead of ascending :)

    Sunday, August 11, 2013 6:25 AM