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

  • Thread starter sean.gilbertson
  • Start date
S

sean.gilbertson

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
 
G

Guest

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>"
 
S

sean.gilbertson

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>"







- 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top