Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Rotate Header Text in GridView

Author  Topic 

seyha_moth
Yak Posting Veteran

74 Posts

Posted - 2006-12-13 : 02:23:35
Dear Sir or Madam

I'm glad to participate in this forum and I hope that I'll receive the good knowledge and guide from here.
I have the problem related to GridView is that I want to Rotate some header text in GridView.Rotation may be
90 degree or 270 degree,especially,my Grid View is bound from database.

Can you help me?
I look forward to hearing from you
Thank you in advance
Good Luck and Succeed your work!

seyha moth

seyha_moth
Yak Posting Veteran

74 Posts

Posted - 2006-12-14 : 02:21:08
Hi,I solve the problem with finding document on msdn forum.The following statement is the description of Eric:

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



seyha moth
Go to Top of Page
   

- Advertisement -