Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Set headertext in datagrid programatically

Reply
Thread Tools

Set headertext in datagrid programatically

 
 
=?Utf-8?B?bWc=?=
Guest
Posts: n/a
 
      05-26-2004
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.
 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      05-27-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically set headertext of a boundfield column John Mason ASP .Net 0 08-20-2006 06:27 AM
boundcolumn headertext set to a code-behind variable? John E. ASP .Net 4 10-14-2004 04:11 PM
Set headertext in datagrid programatically mg ASP .Net Web Controls 1 05-27-2004 12:18 AM
Programatically setting a HeaderTemplate HeaderText. Andy ASP .Net Datagrid Control 1 05-26-2004 07:16 AM
Set Column Headertext =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?= ASP .Net 1 02-27-2004 02:13 PM



Advertisments