Set headertext in datagrid programatically

Discussion in 'ASP .Net' started by =?Utf-8?B?bWc=?=, May 26, 2004.

  1. I create a datagrid using the Web Forms Toolbo

    The dataadapter,dataset and databind() code runs in a button eventhandler

    The headertext is currently determined by the column names of my SQL select statement there

    How can I change the headertext programatically in the codebehind? ... I don't want to change the preexisting code if at all possible.
     
    =?Utf-8?B?bWc=?=, May 26, 2004
    #1
    1. Advertising

  2. in your itemdatabound event handler, you can test for the headeritem and
    then use the text property attached to the cell object to change the text
    e.item.cells[4].text = "vapor"

    --
    Regards,
    Alvin Bruney
    [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
    Got tidbits? Get it here... http://tinyurl.com/27cok
    "mg" <> wrote in message
    news:...
    >I create a datagrid using the Web Forms Toolbox
    >
    > The dataadapter,dataset and databind() code runs in a button eventhandler
    >
    > The headertext is currently determined by the column names of my SQL
    > select statement there.
    >
    > How can I change the headertext programatically in the codebehind? ... I
    > don't want to change the preexisting code if at all possible.
     
    Alvin Bruney [MVP], May 27, 2004
    #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. =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?=

    Set Column Headertext

    =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?=, Feb 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    348
    Martin Dechev
    Feb 27, 2004
  2. John E.
    Replies:
    4
    Views:
    4,720
    John E.
    Oct 14, 2004
  3. John Mason
    Replies:
    0
    Views:
    888
    John Mason
    Aug 20, 2006
  4. Andy

    Programatically setting a HeaderTemplate HeaderText.

    Andy, May 25, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    193
  5. mg

    Set headertext in datagrid programatically

    mg, May 26, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    157
    Kilic Beg
    May 27, 2004
Loading...

Share This Page