DataGrid Heading

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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?
 
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
 
Yes, you have to use ItemCreated event, filter out item types different from
Header and work on Cells collection.

Eliyahu
 
Back
Top