Use DisplayNameAttribute in ASP.NET
<p>I want to bind a List to a GridView on a web page, but override the way the property names display via annotation. I thought System.ComponentModel would work, but this doesn't seem to work. Is this only meant for Windows Forms?:</p>

<pre><code>using System.ComponentModel;

namespace MyWebApp
{
    public class MyCustomClass
    {
        [DisplayName("My Column")]
        public string MyFirstProperty
        {
            get { return "value"; }
        }

    public MyCustomClass() {}
}
</code></pre>

<p>Then on the page:</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{
    IList&lt;MyCustomClass&gt; myCustomClasses = new List&lt;MyCustomClass&gt;
    {
        new MyCustomClass(),
        new MyCustomClass()
    };

TestGrid.DataSource = myCustomClasses;
TestGrid.DataBind();
</code></pre>

<p>}</p>

<p>This renders with "MyFirstProperty" as the column header rather than "My Column." Isn't this supposed to work?</p>
