Home All Groups Group Topic Archive Search About

Change HeaderText of datagrid after binding

Author
14 Mar 2005 9:42 AM
Sangra M via .NET 247
(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>

Author
14 Mar 2005 3:03 PM
Sylvain Lafontaine
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.

Show quoteHide quote
"Sangra M via .NET 247" <anonym***@dotnet247.com> wrote in message
news:uzz2goHKFHA.3336@TK2MSFTNGP10.phx.gbl...
> (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>