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

Weekend Escape to Berjaya Hills, Colmar Tropicale Resort - Day 2

Berjaya Hills (Colmar Tropicale) ေနအထြက္ကုိ ျပတင္းေပါက္ကေနေစာင့္ မနက္ ေစာေစာထ၊ ေရခ်ိဳးျပီးတာနဲ႕ ျပတင္းေပါက္ဖြင့္ျပီး ေနထြက္တာကုိ ေစာင္...