Solved

ASP.net VB.net hide footer cells of GridView

Posted on 2016-10-28
2
32 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 49

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now