Your guess is right. The following is taken from the MSDN:
The Columns collection contains explicitly declared columns that get
rendered in the DataGrid control.
Note Explicitly declared columns may be used in conjunction with
automatically generated columns. When using both, explicitly declared
columns will be rendered first, followed by the automatically generated
columns. Automatically generated columns are not added to the Columns
collection.
Eliyahu
"Laurence" <ha********@hotmail.com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Hi Eliyahu,
I looked at it after databinding. I can get the data from the datagrid but
cannot get the header.
Let me speak more about my request:
I am developing a component to import data from a datagrid. My users also
want to get the headers of the datagrid. However I don't know how to get
the headers. The returned Columns always contain no data.
The DataGrid.AutoGenerateColumns is true by default. I think maybe this
caused my problem but I have to create the columns dynamically.
"Eliyahu Goldin" <re*************@monarchmed.com>
дÈëÏûÏ¢ÐÂÎÅ:eG**************@TK2MSFTNGP14.phx.gbl ...
Are you looking at DataGrid.Columns after databinding or before?
Eliyahu
"Laurence" <ha********@hotmail.com> wrote in message
news:OM**************@TK2MSFTNGP11.phx.gbl... I want to get the column name of a datagrid control. But
DataGrid.Columns always return a collection of count 0.
Thanks for your help in advance.