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?
Member
297 Points
1356 Posts
dynamic data project sorting
Aug 10, 2013 12:54 AM|winseealn@hotmail.com|LINK
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.
All-Star
17916 Points
5681 Posts
MVP
Re: dynamic data project sorting
Aug 10, 2013 06:32 AM|sjnaughton|LINK
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 :)
Always seeking an elegant solution.
Member
297 Points
1356 Posts
Re: dynamic data project sorting
Aug 10, 2013 06:44 AM|winseealn@hotmail.com|LINK
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?
Member
297 Points
1356 Posts
Re: dynamic data project sorting
Aug 10, 2013 06:47 AM|winseealn@hotmail.com|LINK
i tried ur code but, getting below error
Error 4 'System.ComponentModel.DataAnnotations.DisplayAttribute' does not contain a constructor that takes 2 arguments ......
All-Star
17916 Points
5681 Posts
MVP
Re: dynamic data project sorting
Aug 10, 2013 07:13 AM|sjnaughton|LINK
Sorry my Bad its DisplayColumnAttribute
oh the same

Always seeking an elegant solution.
Member
297 Points
1356 Posts
Re: dynamic data project sorting
Aug 10, 2013 07:35 AM|winseealn@hotmail.com|LINK
i dont understand, please tell me what code i have to use? and whee i have to put it?
Member
297 Points
1356 Posts
Re: dynamic data project sorting
Aug 11, 2013 01:37 AM|winseealn@hotmail.com|LINK
finally, i got resolved
i put this code
[DisplayColumn("company_name", "company_name", false)]
on top of public partial class Table1: INotifyPropertyChanging, INotifyPropertyChanged
All-Star
17916 Points
5681 Posts
MVP
Re: dynamic data project sorting
Aug 11, 2013 06:25 AM|sjnaughton|LINK
That last false is optional you only set it to true if you want the sort order to be descending instead of ascending :)
Always seeking an elegant solution.