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

ဆန္းဆန္းတင့္ (၁) ၊ ၾကြက္ကေလးနဲ႕ ကုိယ္

ကုိယ္ဟာ ဆန္းဆန္းတင့္သူတစ္ေယာက္ပါ။ အဲဒိအေၾကာင္းနဲ႕ ပတ္သတ္လုိ႕ အရင္ကေတာ့ ေပါ့ေပါ့ဆဆပါပဲ။ တျဖည္းျဖည္း ေပ်ာ္ရႊင္မွဳေတြ နည္းနည္းလာတာက...