Unplanned
Last Updated: 21 Nov 2016 12:31 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 11 Nov 2016 09:44
Category: GridView
Type: Feature Request
3
ADD. RadGridView - GridViewDataColumn.FormatString property should consider the DisplayFormatAttribute
The specified format in the DisplayFormat attribute should be considered when automatically generating the GridViewDateTimeColumn.

public RadForm1()
{
    InitializeComponent();

    List<Item> items = new List<Item>();
    for (int i = 0; i < 5; i++)
    {
        items.Add(new Item(DateTime.Now.AddDays(i)));
    }

    this.radGridView1.DataSource = items;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
}

public class Item
{
    [System.ComponentModel.DisplayName("My Date")]
    [System.ComponentModel.DataAnnotations.DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
    public DateTime Date { get; set; }

    public Item(DateTime date)
    {
        this.Date = date;
    }
}
0 comments