QA@IT
«回答へ戻る

回答を投稿

VBですが、参考になれば

#Region "GridView ヘッダー部の細工"
    '
    'GridView ヘッダー部の細工
    '
    Private Sub CustomHeader()
        'ヘッダー行を宣言
        Dim row As New GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Alternate)

        Dim Cell1 As New TableHeaderCell
        Dim Cell2 As New TableHeaderCell

        Cell1.Text = "勤務地"
        Cell1.Width = Unit.Pixel(48)
        Cell1.HorizontalAlign = HorizontalAlign.Center
        Cell1.Font.Bold = True

        Cell2.Text = "所属"
        Cell2.Width = Unit.Pixel(48)
        Cell2.HorizontalAlign = HorizontalAlign.Center
        Cell2.Font.Bold = True

        row.Cells.Add(Cell1)
        row.Cells.Add(Cell2)

        GridView1.Controls(0).Controls.AddAt(1, row)

    End Sub
#End Region
VBですが、参考になれば

```
#Region "GridView ヘッダー部の細工"
    '
    'GridView ヘッダー部の細工
    '
    Private Sub CustomHeader()
        'ヘッダー行を宣言
        Dim row As New GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Alternate)

        Dim Cell1 As New TableHeaderCell
        Dim Cell2 As New TableHeaderCell

        Cell1.Text = "勤務地"
        Cell1.Width = Unit.Pixel(48)
        Cell1.HorizontalAlign = HorizontalAlign.Center
        Cell1.Font.Bold = True

        Cell2.Text = "所属"
        Cell2.Width = Unit.Pixel(48)
        Cell2.HorizontalAlign = HorizontalAlign.Center
        Cell2.Font.Bold = True

        row.Cells.Add(Cell1)
        row.Cells.Add(Cell2)

        GridView1.Controls(0).Controls.AddAt(1, row)

    End Sub
#End Region