Change HeaderText of datagrid after binding

Discussion in 'ASP .Net Datagrid Control' started by Sangra M via .NET 247, Mar 14, 2005.

  1. (Type your message here)

    --------------------------------
    From: Sangra
    Hi,
    I got a datagrid which I want to change the headertext after binding.
    Because I have a multi-lingual app and I allow the user to change the
    language on-the-fly. However, the headertext changes only after the
    2ND TIME I pressed the Change language button. I'm doing the change
    during the Page_Load event and I suppose the ASP.NET takes the
    values of the headertexts BEFORE it, so it will be showed only on the
    next time!
    My question is what is the correct event I should catch and change the
    text?
    Many thanks in advance!

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>GgIRLqizMEW0GTv0rPM03A==</Id>
     
    Sangra M via .NET 247, Mar 14, 2005
    #1
    1. Advertising

  2. Using the datagrid's ItemCreated event is probably the best choice. The
    ItemDataBound won't work in this case because the header is not an item (not
    associated with a data). See for example:

    http://msdn.microsoft.com/msdnmag/issues/01/10/cutting/default.aspx
    http://www.codeproject.com/aspnet/MergeDatagridHeader.asp
    http://www.datagridgirl.com/articles.aspx

    S. L.

    "Sangra M via .NET 247" <> wrote in message
    news:...
    > (Type your message here)
    >
    > --------------------------------
    > From: Sangra
    > Hi,
    > I got a datagrid which I want to change the headertext after binding.
    > Because I have a multi-lingual app and I allow the user to change the
    > language on-the-fly. However, the headertext changes only after the
    > 2ND TIME I pressed the Change language button. I'm doing the change
    > during the Page_Load event and I suppose the ASP.NET takes the
    > values of the headertexts BEFORE it, so it will be showed only on the
    > next time!
    > My question is what is the correct event I should catch and change the
    > text?
    > Many thanks in advance!
    >
    > -----------------------
    > Posted by a user from .NET 247 (http://www.dotnet247.com/)
    >
    > <Id>GgIRLqizMEW0GTv0rPM03A==</Id>
     
    Sylvain Lafontaine, Mar 14, 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:
    492
    Andy Wang
    May 12, 2004
  2. Øyvind Isaksen

    Change HeaderText in datagrid

    Øyvind Isaksen, Nov 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    3,952
    Eliyahu Goldin
    Nov 6, 2005
  3. Charly
    Replies:
    1
    Views:
    1,751
    hkjaja
    Feb 20, 2010
  4. Andy Wang

    change HeaderText of DataGrid in PreRender().

    Andy Wang, May 12, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    6
    Views:
    451
    Eliyahu Goldin
    May 16, 2004
  5. 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:
    212
    Ken Cox [Microsoft MVP]
    Jun 18, 2004
Loading...

Share This Page