PagerTemplate不显示时的GridView是空的ASP [英] PagerTemplate does not show when GridView is empty in ASP

查看:224
本文介绍了PagerTemplate不显示时的GridView是空的ASP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个小的ASP.NET应用程序,在那里我有从数据库中访问数据的GridView。我也有一个具有LinkBut​​tons,让我在一个新的记录到数据库中添加PagerTemplate。然而,当表是空的,我不能看到我的传呼机控制,但我没有问题,如果在表中的单个项目。有什么办法,我可以始终显示PagerTemplate。请是我的code的样本。

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.

推荐答案

添加到PagerTemplate了EmptyDataTemplate的内容是一个解决方案。

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

这篇关于PagerTemplate不显示时的GridView是空的ASP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆