Rotated text in a datagrid

  • Thread starter Thread starter Jae
  • Start date Start date
Maybe this will help. You need to use a style.

<%@ Page Language="VB" Strict=True %>

<%@ import Namespace="System.Data" %>

<script language="VB" runat="server">
Sub Page_Load(byVal obj As Object, byVal e As EventArgs)
if not IsPostback
BindData()
end if
End Sub

sub BindData()
Dim dt As New DataTable()
Dim dr As DataRow
dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
Dim i As Integer
For i = 0 To 9
dr = dt.NewRow()
dr(0) = "Item " & i.ToString()
dt.Rows.Add(dr)
Next i
Dim dv As New DataView(dt)
os0.datasource = dv
os0.databind

End sub
</script>
<style>
..sideway { writing-mode:tb-rl}
</style>

<html>
<body>
<form runat="server">
<asp:DataList id="os0" repeatcolumns="2" repeatDirecttion="horizontal"
runat="server">
<ItemTemplate>
<asp:label class="sideway" text='<%#
(DataBinder.Eval(Container.DataItem, "StringValue")) %>' runat="server" />
</ItemTemplate>
</asp:DataList>

</form>
</body>
</html>
 
For a datagrid you will need to do something like this.

<%@ Page Language="VB" Strict=True %>

<%@ import Namespace="System.Data" %>

<script language="VB" runat="server">
Sub Page_Load(byVal obj As Object, byVal e As EventArgs)
if not IsPostback
BindData()
end if
End Sub

sub BindData()
Dim dt As New DataTable()
Dim dr As DataRow
dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
Dim i As Integer
For i = 0 To 9
dr = dt.NewRow()
dr(0) = "<span class=" & chr(34) & "sideway" & chr(34) & ">Item
" & i.ToString() & "</span>"
dt.Rows.Add(dr)
Next i
Dim dv As New DataView(dt)
os0.datasource = dv
os0.databind

End sub
</script>
<style>
..sideway { writing-mode:tb-rl}
</style>

<html>
<body>
<form runat="server">
<asp:DataGrid id="os0" runat="server">


<ItemStyle cssclass="sideway">
</ItemStyle>
<columns>
<asp:BoundColumn DataField="StringValue" />


</columns>
</asp:DataGrid>

</form>
</body>
</html>
 
Back
Top