Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net VB.net hide footer cells of GridView

Hi
I use the following code to hide the header and footer rows of my ASP.net GridView. It works with the header but not the footer.
Why would this be?


Private Sub GridView1_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowCreated

        Try
            If blnHideUnusedColumns = True Then

                If e.Row.RowType = DataControlRowType.DataRow Then
                    If strHideGridColumns <> "" Then

                        Dim arrSplit As Object = Split(strHideGridColumns, ",")
                        Dim oColumnIndex As Integer
                        For i As Integer = 0 To UBound(arrSplit)
                            If IsNumeric(Trim(arrSplit(i))) = True Then
                                oColumnIndex = CInt(Trim(arrSplit(i)))
                                GridView1.HeaderRow.Cells(oColumnIndex).Visible = False
                                e.Row.Cells(oColumnIndex).Visible = False
                                GridView1.FooterRow.Cells(oColumnIndex).Visible = False
                            End If
                        Next

                    End If

                End If

            End If
        Catch ex As Exception
            Response.Write(ex.Message & " s34")
        End Try
    End Sub

User generated image
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thanks very much