We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

DisplayName attribute not working

My simple customer class:
class Customer
{
    [DisplayName("Customer Name")]
    public string Name { get; private set; }

    public Customer(string name)
    {
        Name = name;
    }
}

And the binding logic on a Form control, which contains GridDataBound control:
public partial class Form1 : Form
{
    private readonly List<Customer> _customers;

    public Form1()
    {
        InitializeComponent();

        _customers = new List<Customer>();
        gridDataBoundGrid1.DataSource = _customers;
    }

    private void BtnAddCustomer(object sender, EventArgs e)
    {
        _customers.Add(new Customer("Customer 1"));
        gridDataBoundGrid1.Refresh();
    }
}

If I run my application the first column in the grid is named 'Name' instead of 'Customer Name'. Is DisplayName attribute supported?

4 Replies

SI Simon February 3, 2015 01:59 PM UTC

A possible workaround:

this.gridDataBoundGrid1.Binder.InternalColumns["Name"].HeaderText = "Customer Name";





MK Muthukumar Kalyanasundaram Syncfusion Team February 4, 2015 05:37 PM UTC

Hi Simon,

 

Thanks for using Syncfusion products.

 

The reported issue with “DisplayName attribute not working" has been confirmed as a defect. We have logged a bug report on this reported query. For this, Please create a DT incident for your query so that we can update the patch for this issue.

 

You can create the DT incident from the following link.

<http://www.syncfusion.com/account/dashboard>

 

In the interests of maintaining confidentiality, we have a policy of not sharing patches or otherwise proprietary customer specific information in the public Forum.

 

Please let me know your concerns.

 

Regards,

Muthukumar K.



SI Simon February 5, 2015 01:00 PM UTC



MK Muthukumar Kalyanasundaram Syncfusion Team February 6, 2015 05:42 AM UTC

Hi Simon,

 

Thank you for update.

 

We will update details for your reported query in that incident 134974. Please refer the incident for better follow up. Please let us know if you need any further assistance.

 

Regards,

Muthukumar K


Loader.
Live Chat Icon For mobile
Up arrow icon