Vertical text IN Gridview

Hi Im trying to display the header text of the columns vertically(rotated counter-clockwise 90degrees). I first tried using CSS writing-mode: tb-rl and filter: flipH() flipV() but that seems to only work on tables and not gridviews.

Is there a way I can get a GridView HeaderColumn text to display rotated 90 degrees counter-clockwise Please help if you can. Thanks.

Eric



Answer this question

Vertical text IN Gridview

  • caveman1

    Well I just figured it out on my own after playing around with it for a while. I am writing this to share with anyone else who may also need to rotate text in a gridview. I am only rotating text in the header row, but this should work for all cells in the gridview if needed.

    I am using an external style sheet for my .aspx page ith the following as one of the styles:

    .verticaltext

    {

    font:bold 10px Tahoma;

    color: #0000FF;

    writing-mode: tb-rl;

    filter: flipH() flipV();

    }

    So what I am doing is loading my gridview like usual, and then adding a _DataBound event for the gridview. So here is the code to rotate the header row.

    Protected Sub gvMatrix_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvMatrix.DataBound

    Dim style As New Web.UI.WebControls.Style

    Dim row As GridViewRow = gvMatrix.HeaderRow

    style.CssClass = "verticaltext"

    For Each cell As TableCell In row.Cells

    cell.ApplyStyle(style)

    Next

    end sub

    I hope this helps

    Eric


  • Strini

    it only works on IE not on firefox
    how can we make it compatible to both IE and firefox

  • Vertical text IN Gridview