473,738 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ 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 1706
Handle the "ItemDataBo und" 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.ItemInde x = -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...@discussio ns.microsoft.co mwrote:
Handle the "ItemDataBo und" 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.ItemInde x = -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.A dd(div);

row.Cells.Add(c el);

table_in_my_pag e.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
3504
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 -------------------------------------------------------------- RCSOFT, Lda.
0
998
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 http://www.dnzone.com/ShowDetail.asp?NewsId=599 I want to create 3 template column in datagrid dynamically while the template columns contains image buttons for add, edit and delete. As you can see, I can figure out the commandname inside the...
6
3862
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 = dsAllPastReplies.Tables(0).Columns(iCounter).ColumnName .HeaderText = dsAllPastReplies.Tables(0).Columns(iCounter).ColumnName If .DataField = dsAllPastReplies.Tables(0).Columns("ReplyID").ColumnName Then
1
2481
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 far everything is fine. Now i try to format the embedded datagrid - e.g. setting font size and the column size/width of each column. Everything is working fine, except the width of the columns.
2
6411
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
3543
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 can get this to work; however, the column header on the datagrid is not a link/sortable. What am I missing? Thanks in advance.
4
4778
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 datagrid or gridview: string1, string2, (these next 3 in arrayList) listHeader1, listHeader2, listHeader3 thanks for any help.
5
2904
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, I am appending all the directories with 0 & all the files with 1. Moreover, each directory & file listed in the DataGrid will have a corresponding CheckBox. To differentiate between directories & files, I am adding the string "*D" (without the...
2
6593
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 in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
9473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9259
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8208
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6750
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3279
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 we have to send another system
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.