Thursday, March 22, 2012

Set headertext in datagrid programatically

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 do
n't want to change the preexisting code if at all possible.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" <mg@.theworld.com> wrote in message
news:88A2B342-0B07-4CD5-80AC-8C989FE5C2EA@.microsoft.com...
>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.

0 comments:

Post a Comment