1

I am trying to make a small ASP.NET application where I have a GridView with data being accessed from the database. I also have a PagerTemplate that has LinkButtons that allow me to add in a new record to the database. However when the table is empty I am not able to see my Pager controls, but I have no issues if there is a single entry in the table. Is there any way that I can always display the PagerTemplate. Please is a sample of my code.

<asp:GridView ID="gvResults" runat="server" PageSize="10" AutoGenerateColumns="false"
                CssClass="tablestyle" AllowPaging="true" ShowHeaderWhenEmpty="true">
                <AlternatingRowStyle CssClass="altrowstyle" />
                <HeaderStyle CssClass="headerstyle" />
                <RowStyle CssClass="rowstyle" />
        ...
<PagerTemplate>
<div class="pagers">
    <table class="pagerTable">
        <tr>
            <td align="left">
               <asp:LinkButton ID="btnInsertMediaRate" runat="server" Text="Add New" OnClick="btnNewMediaRate_Click"></asp:LinkButton>
            </td>
        </tr>
    </table>
</div>
</PagerTemplate>
</asp:GridView>

Thanks in advance for your help.

1 Answer 1

2

Add the contents of the PagerTemplate to the EmptyDataTemplate is a solution ..

1
  • I copied the contents from the PagerTemplate into the EmptyDataTemplate and it worked. Thanks for your help.
    – Seb
    Apr 19, 2011 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.