GridView vertical column headings without breaking the sort functionality

rpm
rpm used Ask the Experts™
on
I have a GridVIew table in an ASP.net project. I need the column headings to be oriented vertically.

I have achieved this with the following steps:

1) Adding the following into the head:

    <style>
        .verticaltext
        {
            writing-mode: vertical-rl;
        }
    </style>

2) Adding the following into gvResults_DataBound:

For C = 2 To 16
      gvResults.HeaderRow.Cells(C).Text = "<div class=""verticaltext"">" & gvResults.Columns(C).HeaderText & "</div>"
Next

This has the required visual effect, but unfortunately breaks the ability to click the column heading to sort the table.

Can anyone suggest a way to re-orient the header text without breaking the sort functionality.

Thanks,

Richard
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It's been a while since I've used Gridviews but can you use

      <ItemStyle  CssClass="mystyle" />

with css
.mystyle
{vertical-align: <something here>}

OR

<asp:TemplateField ItemStyle-VerticalAlign="....."

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial