Column Display Name when binding a list to a GridView. (using CSLA 2.0, but a generic question)

Column Display Name when binding a list to a GridView. (using CSLA 2.0, but a generic question)

Old forum URL: forums.lhotka.net/forums/t/4996.aspx


mobile5guy posted on Thursday, June 19, 2008

I have a Business Object that I am binding to a GridViewvia gv.Datasource = blah then calling DataBind. The column names are auto generated, but I need to change them. Something like:

    <DisplayName("First Name")> _
    Public Property Name() As String
        Get
            Return _Name
        End Get
        Set(ByVal value As String)
            If _Name = value Then
                Return
            End If
            _Name = value
        End Set
    End Property

But the DisplayNameAttribute works on property pages, and not the GridView.

Using: ASP.NET & VB.NET 2.0.

Thanks for any help.
Mobile5Guy

Copyright (c) Marimer LLC