2008-03-20 gridview多表頭 3321 0 ASP.NET gridview多表頭 Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated If e.Row.RowType = DataControlRowType.Header Then Dim ogridview As GridView = CType(sender, GridView) Dim ogirdviewrow As GridViewRow = New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert) Dim otablecell As TableCell = New TableCell 'add department otablecell.Text = "Department" otablecell.ColumnSpan = 3 ogirdviewrow.Cells.Add(otablecell) 'add employee otablecell = New TableCell otablecell.Text = "Employee" otablecell.ColumnSpan = 2 ogirdviewrow.Cells.Add(otablecell) ogridview.Controls(0).Controls.AddAt(0, ogirdviewrow) End If End Sub ASP.NET 回首頁