Golda
Golda

Reputation: 3891

How to do colspan in gridview row in asp.net

How can I achieve the following format in gridview

enter image description here

Upvotes: 1

Views: 7827

Answers (1)

Juan Esquerre
Juan Esquerre

Reputation: 21

I had the same problem, this is the solution that I found. this is in VB

Protected Sub GridV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridV.RowDataBound
    If (e.Row.RowType = DataControlRowType.DataRow) Then
        'Here put the condition 
        If e.Row.Cells(3).Text = "0" Then 
            e.Row.Cells(1).ColumnSpan = 4
            e.Row.Cells(2).Visible = False
            e.Row.Cells(3).Visible = False
            e.Row.Cells(4).Visible = False
        End If
    End If
End Sub

I hope this work for you.

Juan F. Esquerre

Upvotes: 2

Related Questions