[VB]GridView 合併儲存格
需寫在PreRender 頁面呈現之前引發。
Protected Sub gv_screen_filter_PreRender(sender As Object, e As EventArgs) Handles gv_screen_filter.PreRender
Dim i As Integer = 1
Dim wkItem As GridViewRow
For Each wkItem In gv_screen_filter.Rows
If CInt(wkItem.RowIndex) = 0 Then
wkItem.Cells(0).RowSpan = 1
Else
If wkItem.Cells(0).Text.Trim() = gv_screen_filter.Rows(CInt(wkItem.RowIndex) - i).Cells(0).Text.Trim() Then
gv_screen_filter.Rows(CInt(wkItem.RowIndex) - i).Cells(0).RowSpan += 1
i = i + 1
wkItem.Cells(0).Visible = False
Else
gv_screen_filter.Rows(CInt(wkItem.RowIndex)).Cells(0).RowSpan = 1
i = 1
End If
End If
Next
End Sub
留言
張貼留言