473,486 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to put a DIV inside a DataGrid's column header?

Hi everyone,

I'm adding columns to a DataTable, so that I can set it as the
DataSource for a DataGrid. How can I go about putting a DIV element
inside one of the column headers? I'm fine with taking another
approach.

Thanks :-)
Sean

Feb 9 '07 #1
2 1696
Handle the "ItemDataBound" event, which is invoked for every row (including
the header) that is added to a datagrid. You will know its the header row by
checking if e.Item.ItemIndex = -1. From there I believe you can just set
e.Item.Cells(0).text = "<div></div>"

"se*************@gmail.com" wrote:
Hi everyone,

I'm adding columns to a DataTable, so that I can set it as the
DataSource for a DataGrid. How can I go about putting a DIV element
inside one of the column headers? I'm fine with taking another
approach.

Thanks :-)
Sean

Feb 9 '07 #2
On Feb 9, 3:50 pm, Keith <K...@discussions.microsoft.comwrote:
Handle the "ItemDataBound" event, which is invoked for every row (including
the header) that is added to a datagrid. You will know its the header row by
checking if e.Item.ItemIndex = -1. From there I believe you can just set
e.Item.Cells(0).text = "<div></div>"

"sean.gilbert...@gmail.com" wrote:
Hi everyone,
I'm adding columns to a DataTable, so that I can set it as the
DataSource for a DataGrid. How can I go about putting a DIV element
inside one of the column headers? I'm fine with taking another
approach.
Thanks :-)
Sean- Hide quoted text -

- Show quoted text -
Keith,

Thanks for responding :-)

I actually took this approach, after deciding to keep digging instead
of waiting and lamenting (which can happen with me :-):

/*---------------------*/

TableRow row = new TableRow();

TableCell cell = new TableCell();

/* This is the important part ;-) */
Panel div = new Panel();

cell.Controls.Add(div);

row.Cells.Add(cel);

table_in_my_page.Rows.Add(row);

/*---------------------*/

It works perfectly! I'm very happy with it. And now that I'm rolling
along, I'm very pleased with what ASP.NET 2.0 and Atlas can do!!
We'll see where I can go from here :-)

Take care,
Sean

Feb 9 '07 #3

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

Similar topics

1
3480
by: | last post by:
How I can autosize a DataGrid after then associate a Datasource=Dataset in Smart Devices applications or Windows forms application?? That same?? -- Cumprimentos, David de Passos...
0
965
by: Andy Eshtry | last post by:
Hello Dear Professionals: Based on this document: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwebservercontroltemplatesdynamically.asp or this...
6
3845
by: Jon | last post by:
Hello, I have a datagrid and the data in it is dynamically created at runtime... For iCounter = 0 To dataset.Tables(0).Columns.Count - 1 Dim objbc As New BoundColumn() With objbc .DataField...
1
2466
by: Drew | last post by:
Hey, thanks in advance for helping me out with my problem: I have a datagrid which is embedded in another datagrid. The datagrid is filled directly by a dataset generated from a sql query. So...
2
6371
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
3
3513
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
4
4765
by: rjl | last post by:
Is there a way to assign an arraylist inside an arraylist as a column? i have arrayList list, which has 2 Strings and an arrayList with 3 values. I would like the following columns then in a...
5
2849
by: rn5a | last post by:
In my application, I want to populate all the directories & files existing in a directory on the server in a DataGrid. To ensure that all the directories get listed first followed by all the files,...
2
6556
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
7099
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
6964
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
7175
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...
1
6842
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
7319
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5430
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
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.