Change HeaderText in datagrid

  • Thread starter Thread starter Øyvind Isaksen
  • Start date Start date
Ø

Øyvind Isaksen

Hi friends!

I have a Datagrid with AutoGenerateColumns = True.
How can I rename the headertext without using ASP:BoundColumn? I dont want
to show the database names, but make my own header names. I also need to
have the AutoGenerateColumns = True.

I Use VB.net :)


Thanks!!!
 
With AutoGenerateColumns = True your only chance to catch header text is the
ItemCreated event. In the event handler you can catch the header by checking
e.Item.ItemType property, where e is the event argument of type
DataGridItemEventArgs. Once you detect the header, you can change the header
text as e.Item.Cells.Text.

Eliyahu
 
Back
Top