Set Column Headertext

G

Guest

Hi
I have a Datagrid with a templatecolumn, where I add at design time. I also checked the "create columns automatically"
I would like to change the headertext of columns created automatically, but i don't know in which event I can do that

Can you help me

P.S. I tryied to set the headertext in the "PreRender" event of the DataGrid, but in this point the grid has still only the templatecolumn, and the others columns aren't created yet

Thank you
Alessandro Ross
 
M

Martin Dechev

Hi, Alessandro Rossi,

If you extend the DataGrid class (inherit from it) the best place is the
OnDataBinding protected method. You should first call base.OnDataBinding(e);
of course.

If you are simply using the DataGrid class - set the headertexts after you
call DataBind() because the columns are in fact created with this call.

Hope this helps
Martin
Alessandro Rossi said:
Hi,
I have a Datagrid with a templatecolumn, where I add at design time. I
also checked the "create columns automatically".
I would like to change the headertext of columns created automatically,
but i don't know in which event I can do that.
Can you help me?

P.S. I tryied to set the headertext in the "PreRender" event of the
DataGrid, but in this point the grid has still only the templatecolumn, and
the others columns aren't created yet.
 

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,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top