Why are my Paging controls not visible at runtime in my GridView control?

Posted on 2014-08-23
Last Modified: 2014-08-23

I'm trying to implement an GridView control with paging. A lot of descriptions indicate that by setting a couple of quick properties, paging will "just work."

The issue I have is that the paging controls are not displaying at the bottom of my GridView.
I see them in VS Designer.

When I inspect the generated table in the browser debugger, I see that an empty row <tr> has
been created at the last row in the generated table (presumably this is where the paging controls will be inserted).

Here is the HTML gridview definition:
<asp:gridview id="gvMasters1" runat="server" cssclass="tblMasterDetail" AutoGenerateColumns="False" 
   CellPadding="0"  pagerstyle-mode="NumericPages" pagerstyle-pagebuttoncount="20" PageSize="5" 
   EnableViewState="true" AllowPaging="True" PagerSettings-PreviousPageText="Previous Page" 
   PagerSettings-NextPageText="Next Page" PagerSettings-Mode="NextPreviousFirstLast" 
   PagerSettings-LastPageText="Last Page" PagerSettings-FirstPageText="First Page" 
   ClientIDMode="Static" allowsorting="True" visible="True">
       <headerstyle cssclass="HeaderStyle" />
       <alternatingrowstyle cssclass="AlternatingRowStyle" />
       <selectedrowstyle cssclass="SelectedRowStyle" />

Open in new window

I'm using a DataTable as my GridView datasource.
Here is a snapshot of my codebehind:
 gvMasters.AutoGenerateColumns = True
        dvMasters = dtMasters.DefaultView
        Dim strKeys() = {"TxnID"}
        gvMasters.DataKeyNames = strKeys
        gvMasters.DataSource = dvMasters

        ' If return results are empty, we still want to display columns
        If dtMasters.Rows.Count <= 0 Then
            isEmpty = True
        End If


        If isEmpty Then
            gvMasters.Rows(0).Visible = False
        End If

        gvMasters.Visible = True

Open in new window

I have spent several hours trying to figure this out.
What am I doing wrong/missing here?
Can someone point me in the right direction?

Question by:jxbma
    1 Comment
    LVL 1

    Accepted Solution

    Figured it out.
    I was setting a cell's visibility instead of using CSS class display to do so.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    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…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    761 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

    8 Experts available now in Live!

    Get 1:1 Help Now