Rowspan in GridView ( VB.Net )





 Private Sub GridView1_PreRender(sender As Object, e As EventArgs) Handles GridView1.PreRender
        MergeRowsWithSameContent(sender)
End Sub


Public Sub MergeRowsWithSameContent(gvw As GridView)
        For rowIndex As Integer = gvw.Rows.Count - 2 To 0 Step -1
            Dim row As GridViewRow = gvw.Rows(rowIndex)
            Dim previousRow As GridViewRow = gvw.Rows(rowIndex + 1)

            For i As Integer = 0 To row.Cells.Count - 1
                If row.Cells(i).Text = previousRow.Cells(i).Text Then
                    row.Cells(i).RowSpan = If(previousRow.Cells(i).RowSpan < 2, 2, previousRow.Cells(i).RowSpan + 1)
                    previousRow.Cells(i).Visible = False`
                End If
            Next
        Next
End Sub



(Ref: http://stackoverflow.com/questions/11129762/how-to-implement-rowspan-in-a-gridview-for-net-3-5)

No comments:

Post a Comment

Penang 4D3N Free & Easy - Intro

ပီနန္က်ြန္း၊  မေလးရွားနုိင္ငံ။ ေအာက္တုိဘာ ၆ ရက္မွ ၉ ရက္။ စေန၊ တနဂၤေနြ၊ တနၤလာ၊ အဂၤါ။ ဒီလုိေတြ စီစဥ္ၾကတာ။ ဒီခရီးကေတာ့ သြားခါနီး ၂ ရက္အ...