gridview中将header的多列合并为一列

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 oCell As New TableCell
            oCell.ColumnSpan = e.Row.Cells.Count
            e.Row.Cells.Clear()
            oCell.Text = "Merged header"
            e.Row.Cells.Add(oCell)
        End If
End Sub

当然也可以在GridView_DataBound()事件中进行合并.
posted @   margiex  阅读(765)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示