473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Set headertext in datagrid programatically

mg
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.
Nov 18 '05 #1
1 1562
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:88**********************************@microsof t.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.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Toma Marinov | last post by:
First, excuse me for my very bad English. I need your help for using DataGrid.Columns.HeaderText I have a DataGrid in WebForm . I have a Session variable "LANGUAGE " in wich I storing values...
1
by: developer | last post by:
I have a Windows form that contains a datagrid populated with a table in my database. When i load my form i want a particular row in my datagrid to be selected. How can i do that Thanks
1
by: Alessandro Rossi | last post by:
Hi I have a Datagrid with a templatecolumn, where I add at design time. I also checked the "create columns automatically" I would like to change the headertext of columns created automatically, but...
0
by: Dan Hartshorn | last post by:
VS.NET 2003, C#, Windows Server 2003. I have a datagrid and I want the last column to be either an EditCommandColumn or a template column, depending on a value I have. The value changes for each...
0
by: Andy Wang | last post by:
I need change HeaderText of DataGrid in PreRender(). But it seems doesn't work. The code example like this: Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)...
1
by: DotNetJunkies User | last post by:
Hi, I was wondering if it is possible to load datagrid into datalist programatically using ITemplate interface with the following structure and place intp placeholder control. PlaceHolder -...
4
by: John E. | last post by:
I have an ASP.NET datagrid with several bound columns. I need to make the header of some of these columns display a string that is generated from the code behind (i.e. a dynamic header). How is...
1
by: =?Utf-8?B?SGFycnkgS2Vjaw==?= | last post by:
I have a GridView control with a few columns declared directly in the aspx file. I have found that if I remove the HeaderText property from all columns that the GridView handles state completely...
3
by: rn5a | last post by:
A DataGrid has the following TemplateColumn: <asp:DataGrid ID="dgCart"...OnSortCommand="SortGrid" AllowSorting="true"....> <Column> <asp:TemplateColumn HeaderImageUrl="Images\Up.gif"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.