Solved

ASP.net VB.net hide footer cells of GridView

Posted on 2016-10-28
2
59 Views
Last Modified: 2016-10-28
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

1
0
Comment
Question by:murbro
2 Comments
 
LVL 50

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 41863518
in the condition:

If blnHideUnusedColumns = True Then

Open in new window


you may add:
If e.Row.RowType = DataControlRowType.Footer Then
        e.Row.Visible = false
End If

Open in new window

0
 

Author Closing Comment

by:murbro
ID: 41863675
Thanks very much
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question