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

DisplayAttribute.Order not working

8 Answers 202 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christian Schuberth
Top achievements
Rank 1
Christian Schuberth asked on 30 Dec 2009, 04:09 PM
Hello,

I tried to use the DisplayAttribute on my properties to make GridView automatically generate columns.
The columns are displayed but the attribute "Order" seems to get ignored:


[
[Display(ResourceType = typeof(Loc), Name = "LTitle", Description = "LTitleDescription", Order = 0)] 
public string Title {getset; } 
Display(ResourceType = 
typeof(Loc), Name = "LFirstName", Description = "LFirstNameDescription", Order = 1)] 
public string FirstName { getset; } 

The colums are displayed, but in the wrong order.




8 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Jan 2010, 10:03 AM
Hello Christian,

This will be added for our upcoming service pack - next week. I've added 2000 Telerik points to your account.

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Christian Schuberth
Top achievements
Rank 1
answered on 04 Jan 2010, 10:34 AM
That's great! Thankyou!
0
Kowal
Top achievements
Rank 1
answered on 11 May 2010, 02:09 PM
Hello,

I see there are some changes in changelog for Q1 2010 that suggest you've added support for "Order" attribute. However in my very simple solution it still doesn't work. Can you confirm that column ordering is supported in the newest build of your silverlight controls?

Here is a part of my solution:

Person.cs
using System; 
using System.Net; 
using System.Windows; 
using System.ComponentModel.DataAnnotations; 
 
namespace SilverlightApplication1 
    public class Person 
    { 
        [Display(Name="FName", Order=10, ShortName="test name")] 
        public string FirstName { getset; } 
 
        [Display(Name = "Last Name", Order = 1)] 
        public string LastName { getset; } 
 
        [Display(Order = 11)] 
        public int Age { getset; } 
 
        [Display(Order = 111)] 
        public DateTime DateOfBirth { getset; } 
 
        [Display(Order = 2)] 
        public bool Married { getset; } 
    } 
 
 

MainPage.xaml.cs
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
 
namespace SilverlightApplication1 
    public partial class MainPage : UserControl 
    { 
        public MainPage() 
        { 
            InitializeComponent(); 
 
            List<Person> persons = new List<Person>(); 
            for (int i = 0; i < 100; i++) 
            { 
                persons.Add(new Person() 
                { 
                    FirstName = "John"
                    LastName = "Smith " + (i % 10), 
                    Age = i, 
                    DateOfBirth = new DateTime(2010, 5, (i % 10) + 1), 
                    Married = (i % 2 == 1) 
                }); 
            } 
 
            telerikGrid.ItemsSource = persons; 
        } 
    } 
 

MainPage.xaml
<UserControl x:Class="SilverlightApplication1.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    d:DesignHeight="300" d:DesignWidth="400"
 
    <Grid x:Name="LayoutRoot" Background="White"
        <telerik:RadGridView Name="telerikGrid" AutoGenerateColumns="True"/> 
    </Grid> 
</UserControl> 
 

Regards,
Marcin



0
Tsvyatko
Telerik team
answered on 14 May 2010, 09:35 AM
Hi Kowal,

Since Q1 2010 SP1 we have added order attribute support. I have prepared sample application demonstrating it using the posted snippets.

If you have any other questions or issues do not hesitate to contact us.

Greetings,
Tsvyatko
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Kowal
Top achievements
Rank 1
answered on 14 May 2010, 10:38 AM
Hello,

Thank you for your quick reply.
However, using the newest trial build of SL controls (2010.1.422.1040), columns are not being reordered according to Order attribute. Your example solution has references to  v2010.1.422.1030 of SL controls and it seems to work OK. Maybe this is the reason of my problems?

Greetings
Marcin


0
Tsvyatko
Telerik team
answered on 14 May 2010, 11:25 AM
Hi Kowal,

It seems that the problem indeed appears in this version. If you can, please use the 2010.1.422.1030 version, otherwise I can suggest to use our next internal built (available later today).

Please, excuse us for the inconvenience caused.

Greetings,
Tsvyatko
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Luc
Top achievements
Rank 1
answered on 27 May 2010, 11:22 AM
Hello,

I have the save ordering problem with the latest release built 2010.1.422.1040 for the radgridview.
I see you have mentioned it being solved by your internal build, which version would that be? and when do you
anticipate this issue to be addressed or solved soon.

0
Tsvyatko
Telerik team
answered on 27 May 2010, 12:02 PM
Hi Luc,

The issue has been resolved in build - 2010.1.515.1030 and it will be available in our next major releases as well.

Regards,
Tsvyatko
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Christian Schuberth
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Christian Schuberth
Top achievements
Rank 1
Kowal
Top achievements
Rank 1
Tsvyatko
Telerik team
Luc
Top achievements
Rank 1
Share this question
or