Solved

ASP.net VB.net hide footer cells of GridView

Posted on 2016-10-28
2
70 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 51

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

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 …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

749 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