Edit DataGrid Header

M

Mike Smith

Hey ppl...

I got my datagrid column edited by coding the ItemDataBound event with the
following code:

If e.Item.ItemType=ListItemType.Header Then
e.Item.Cells(6).Text="Rental (USD)"
End if

I find that when i display the grid now, the column headers doesn't have the
hyperlink behavior and therefore i cant sort it. How do i go about adding
the hyperlink behavior ? Why does it go off when you change the header ?

regards,
Mike
 
J

Jos

Mike said:
Hey ppl...

I got my datagrid column edited by coding the ItemDataBound event
with the following code:

If e.Item.ItemType=ListItemType.Header Then
e.Item.Cells(6).Text="Rental (USD)"
End if

I find that when i display the grid now, the column headers doesn't
have the hyperlink behavior and therefore i cant sort it. How do i go
about adding the hyperlink behavior ? Why does it go off when you
change the header ?

regards,
Mike

What about:
(CType(e.Item.Cells(6).Controls(0),HyperLink)).Text="Rental (USD)"
 
M

Mike Smith

hey jos...
i tried that code out.. didnt seem to work ... the column retained its
original name itself as RENTAL
it wasnt assigned the new RENTAL (USD) .
Any other suggestions ?
is there a recommended best practice in dealin with datagrids and data ?
Boundcolumns ? guess i have to sit my butt down and do the templates and all
that ?
 
M

Mike Smith

i got it done in ItemDataBound....
it was LinkButton instead
CType(e.Item.Cells(6).Controls(0), LinkButton).Text = "Rental (USD)"

Thank JOS !
 

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

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,195
Latest member
tewan

Latest Threads

Top