DataGrid Heading

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?
 
Y

Yunus Emre ALPÖZEN

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?
 
G

Guest

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
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top