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


I'm trying to implement an ASP.net 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?

jxbmaSoftware ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.