Change HeaderText in datagrid

Discussion in 'ASP .Net' started by Øyvind Isaksen, Nov 6, 2005.

  1. Hi friends!

    I have a Datagrid with AutoGenerateColumns = True.
    How can I rename the headertext without using ASP:BoundColumn? I dont want
    to show the database names, but make my own header names. I also need to
    have the AutoGenerateColumns = True.

    I Use VB.net :)


    Thanks!!!
    Øyvind Isaksen, Nov 6, 2005
    #1
    1. Advertising

  2. With AutoGenerateColumns = True your only chance to catch header text is the
    ItemCreated event. In the event handler you can catch the header by checking
    e.Item.ItemType property, where e is the event argument of type
    DataGridItemEventArgs. Once you detect the header, you can change the header
    text as e.Item.Cells.Text.

    Eliyahu

    "Øyvind Isaksen" <> wrote in message
    news:OXj2h%...
    > Hi friends!
    >
    > I have a Datagrid with AutoGenerateColumns = True.
    > How can I rename the headertext without using ASP:BoundColumn? I dont want
    > to show the database names, but make my own header names. I also need to
    > have the AutoGenerateColumns = True.
    >
    > I Use VB.net :)
    >
    >
    > Thanks!!!
    >
    >
    >
    >
    >
    >
    Eliyahu Goldin, Nov 6, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Wang
    Replies:
    0
    Views:
    472
    Andy Wang
    May 12, 2004
  2. Charly
    Replies:
    1
    Views:
    1,737
    hkjaja
    Feb 20, 2010
  3. Andy Wang

    change HeaderText of DataGrid in PreRender().

    Andy Wang, May 12, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    6
    Views:
    411
    Eliyahu Goldin
    May 16, 2004
  4. Ravi Gudlavalleti

    How do I change the headertext of a datagrid column programmatically

    Ravi Gudlavalleti, Jun 17, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    194
    Ken Cox [Microsoft MVP]
    Jun 18, 2004
  5. Sangra M via .NET 247

    Change HeaderText of datagrid after binding

    Sangra M via .NET 247, Mar 14, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    281
    Sylvain Lafontaine
    Mar 14, 2005
Loading...

Share This Page