473,408 Members | 2,027 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,408 software developers and data experts.

DataGrid Heading

I am wanting to change the headers on my datagrid in code because the
contrents of my grid are dynamic and I was wondering how to do this. I do
not see a property in the datagrid.columns which would allow me to change
the headings. Do I have to use one of the events to trap and change these
headings?
Nov 19 '05 #1
4 1338
I don't know the situation that would like to accomplish this, but simply
allow datagrid create columns dynamically. Perhaps you need to wrap your
datatable to another datatable. The column names will be headers. This is
simplest the way... Is it enough for u?

--

Thanks,
Yunus Emre ALPÖZEN

"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
I am wanting to change the headers on my datagrid in code because the
contrents of my grid are dynamic and I was wondering how to do this. I
do
not see a property in the datagrid.columns which would allow me to change
the headings. Do I have to use one of the events to trap and change these
headings?

Nov 19 '05 #2
Jim,

If you know what column will be what, then you can use the
columns.headertext property as follows:

dgTimecards.Columns[0].HeaderText = "New Text for Column Index 0";

Be sure to do this after you bind so that the columns are created.

Thanks,
Ian Suttle
http://www.IanSuttle.com

"Jim Heavey" wrote:
I am wanting to change the headers on my datagrid in code because the
contrents of my grid are dynamic and I was wondering how to do this. I do
not see a property in the datagrid.columns which would allow me to change
the headings. Do I have to use one of the events to trap and change these
headings?

Nov 19 '05 #3
http://www.extremeexperts.com/Net/Ar...gdatagrid.aspx
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
I am wanting to change the headers on my datagrid in code because the
contrents of my grid are dynamic and I was wondering how to do this. I
do
not see a property in the datagrid.columns which would allow me to change
the headings. Do I have to use one of the events to trap and change these
headings?

Nov 19 '05 #4
Yes, you have to use ItemCreated event, filter out item types different from
Header and work on Cells collection.

Eliyahu

"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
I am wanting to change the headers on my datagrid in code because the
contrents of my grid are dynamic and I was wondering how to do this. I do not see a property in the datagrid.columns which would allow me to change
the headings. Do I have to use one of the events to trap and change these
headings?

Nov 19 '05 #5

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

Similar topics

1
by: Bill | last post by:
Hi I am trying to change the Heading Name on a Datagrid from BudgID to "Budget ID" I am loading the data in fine but the HeaderText does not change or any of the other properties. The...
0
by: Robert Brinson | last post by:
Hello all! I'm running .NET Framework 1.1 using VS.NET 2003. I've got a mystery with a DataGrid. Below is the definition of the DataGrid from my aspx page: </asp:datagrid><asp:datagrid...
4
by: Jim Heavey | last post by:
Hello, I am trying to figure out how to add an extra row of heading to my datagrid. I came up with the following code: Public Sub dgNewMovies_ItemCreated(ByVal sender As Object, ByVal e As...
10
by: Alan Lambert | last post by:
I am writing a web-based reporting tool and using a datagrid to display information returned from a database. I am displaying column headings from bound columns with no problems but I need to...
1
by: wh1974 | last post by:
I'm not sure if i'm heading in the right direction so would appreciate any comments on what I'm trying to do. Basically I have a DataGrid on a page which has columns whose width's I set in the...
4
by: Adrian Parker | last post by:
Can someone tell me how to be able to force line breaks in a datagrid column heading? If the text contains "abc<br>def" then that is what comes out; the source view contains the "abc&lt;br&gt;def". ...
4
by: cooltech77 | last post by:
Hi, I am trying to build the following functionality in the datagrid. I have a lot of columns in the datagrid which are being populated from the database and the user needs to scroll...
2
by: mark4asp | last post by:
This page is currently using a Repeater control to create a table with 6 columns. The first column has 2 ImageButton controls and a common header. How can I do this with a DataGrid ? I need...
1
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on...
0
by: agarwalsunitadhn | last post by:
hi.. I had created some reports using Datagrid and now i want to export this to Ms-Excel. I moved the datagrid to ms-excel. but now my problem is that it move the data but there is no heading...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.