Visual Basic .Net 2003 ASP.Net 1.1で開発中です。
1列のテーブルを表示する際に、列毎にRowSpanを使って、
可変にしようとしています。
ところが、外の大枠が固定になっているのか、途中で、セルが右側に割り当てられ、
ばらばらの表になってしまいます。
また、1つのセルの高さを10ピクセルに設定しているはずが、
RowSpanで2と設定した行は20ピクセルより広くなってしまいます。
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' ページを初期化するユーザー コードをここに挿入します。
' Create a TableItemStyle object that can be
' set as the default style for all cells
' in the table.
Dim tableStyle As New TableItemStyle
tableStyle.HorizontalAlign = HorizontalAlign.Center
tableStyle.VerticalAlign = VerticalAlign.Middle
tableStyle.Width = Unit.Pixel(95)
tableStyle.Height = Unit.Pixel(10)
' Create more rows for the table.
Dim i As Integer
For i = 0 To 5
Dim tempRow As New TableRow
Dim j As Integer
j = 0
Dim tempCell As New TableCell
tempCell.RowSpan = i
tempCell.Text = "(" & i & "," & j & ")"
tempRow.Cells.Add(tempCell)
Table1.Rows.Add(tempRow)
Next i
' Apply the TableItemStyle to all rows in the table.
Dim r As TableRow
For Each r In Table1.Rows
Dim c As TableCell
For Each c In r.Cells
c.ApplyStyle(tableStyle)
Next c
Next r
' Create a header for the table.
Dim header As New TableHeaderCell
header.RowSpan = 1
header.ColumnSpan = 1
header.Text = "Values"
header.Font.Bold = True
header.BackColor = Color.CornflowerBlue
header.HorizontalAlign = HorizontalAlign.Center
header.VerticalAlign = VerticalAlign.Middle
' Add the header to a new row.
Dim headerRow As New TableRow
headerRow.Cells.Add(header)
' Add the header row to the table.
Table1.Rows.AddAt(0, headerRow)
End Sub
外枠によって行の幅が決まり、RowSpanによって行が増えると、
入らない部分は勝手に横へ割り振られているような感じを受けます。
なんとか、固定幅の行で計算し、1列の表示かつRowSpanを使って行の幅を可変に出来ないものでしょうか。
ご教授よろしくお願いいたします。