This is a migrated thread and some comments may be shown as answers.

Sorting fields

1 Answer 36 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 2
Edward asked on 11 Dec 2012, 04:23 PM
Hi,

Sometimes we need to change the sort order because some clients want a different input order.

So, I was wondering if (and how)  it possible to adjust the soring order of the fields in code behind. I bind it against an annotated object.


Thanks,
Edward

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivan Ivanov
Telerik team
answered on 14 Dec 2012, 04:42 PM
Hello,

For auto-generated fields, you can assign sorting logic by using the DataAnnotations.Display attribute. Like this:

[Display(Order = 0)]
        public int StadiumCapacity
        {
            get { return this.stadiumCapacity; }
            set
            {
                if (value != this.stadiumCapacity)
                {
                    this.stadiumCapacity = value;
                    this.OnPropertyChanged("StadiumCapacity");
                }
            }
        }

Kind regards,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DataForm
Asked by
Edward
Top achievements
Rank 2
Answers by
Ivan Ivanov
Telerik team
Share this question
or