- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
如果只有一页数据,如何隐藏DataPager?
在 DataPager 事件中,我有一个 asp:Button
,单击它会获取记录。
有时只有一条记录,如果有一条记录,我需要隐藏寻呼机。
它可以在回发时完成,但我不知道页数的属性是什么。
最佳答案
MSDN 上有一篇博客文章涵盖了这个主题:
How to hide a DataPager control when there is only one page of data
One way of achieving this is to change the visibility of the control on the DataBound event of the ListView control. For example:
protected void ListView1_DataBound(object sender, EventArgs e)
{
DataPager1.Visible = (DataPager1.PageSize < DataPager1.TotalRowCount);
}In the example above, the DataPager is not inside the ListView control. If you place the DataPager inside the LayoutTemplate, then you have to tweak the code a little bit to find the control inside ListView. For example:
protected void ListView1_DataBound(object sender, EventArgs e)
{
DataPager pager = (DataPager) ListView1.FindControl("DataPager1");
pager.Visible = (pager.PageSize < pager.TotalRowCount);
}
关于c# - 如果 Pages = 1,则隐藏 DataPager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9321757/
我在silverlight 应用程序中使用DataPager 控件。我对不同的 DataGrids 有不同的寻呼机,并且希望对所有这些寻呼机使用相同的事件处理程序来处理 PageIndexChange
我有一个连接到 DataPager 的 ListView 控件(或相反!),想知道是否有人可以告诉我如何设置 NumericPagerField 字段的宽度?我已经尝试通过 NumericButton
我有一个使用 ListView 来显示结果的搜索。我还使用 DataPager 来处理结果的分页。
我有一个 ListView 控件和一个应用于它的 DataPager 控件(设置了 DataPager'PagedControlID到 ListView'ID)。 碰巧我以这种方式将 ListView
我在 ListView 控件中有 LinkButton,我想通过单击 LinkButton 在 DataPager 中获取事件编号页面。 protected void addToCart_Cl
我正在使用 ListView/DataPager。 出于性能原因,我使用 ROW_NUMBER(SQl2005) 在数据库中对结果进行分页。 在我的 C# 代码中,一次只出现一页。我怎么能告诉 Dat
我有一个 ListView,我正在将数据绑定(bind)到一组对象,如下所示: int total; List clientList = clientData.GetClients(crite
我正在尝试使用 DataPager 进行服务器端分页。这是我的代码 隐藏代码 protected void Page_Load(object sender, EventArgs e)
我有一个简单的 ListView,由 DataPager 分页,提供产品列表。当我们点击产品时,我们会打开产品详细信息页面。在详细信息页面上,我们希望“返回到产品列表”,但我们当然希望它记住数据分页器
我得到了一个包含新闻条目的数据集。每个新闻项目都包含以下元素:id、title、briefDesc、fullDesc、imgUrl、dateCreated 等。我想使用 ListView 和 Data
我要用 25 个问题进行测试,所以我为问题创建了一个用户控件,并创建了一个 ListView 页面,其中仅包含问题用户控件 这是问题usercontrol的cs public partial clas
我有一个 ListView,我正在使用 DataPager 进行分页。我想在 Page_Load 上设置寻呼机的初始页面。我已经尝试过 DataPager.SetPageProperties 方法,但
我如何改变我的 DataPager 控件中元素的位置 我怎样才能得到这个订单 >> 这是我的代码 " PreviousPageText=
我正在使用 DataPager 像这样在页面之间导航: ' NavigateUrl='' ImageHeight="250" ImageWidth="180">
我有一个连接到 SQL 数据库的 ListView 控件,我设置了一个数据分页器来限制每页上显示的项目(每页 3 个)。 我已将数据分页器设置为:visible=false 并想知道如何使数据分页器每
我目前手动完成分页,我使用这段代码来显示它 1 2 » 我想使用 DataPager 控件为我进行分页,我已经让分页工作得很好,但我无法正确粘贴和显示 CS
如果只有一页数据,如何隐藏DataPager? 在 DataPager 事件中,我有一个 asp:Button,单击它会获取记录。 有时只有一条记录,如果有一条记录,我需要隐藏寻呼机。 它可以在回发时
我有一个带有 RIA 服务的 Silverlight 3 应用程序,我遇到了一个问题,我的 DataPager 只加载初始加载大小的数据,然后不再重新加载。它显示了两页数据(PageSize=10,L
我仍在尝试使用 Silverlight 和 RIA 服务站稳脚跟,当然还要从一些更“有趣”的东西开始,比如网格和智能分页。我可以连接到 RIA 服务(使用自制的 ORM,而不是 L2S 或 EF),在
从我读过的所有内容来看,似乎将分页添加到 ListView 控件应该非常简单,但它对我不起作用。在将 ListView 和 DataPager 控件添加到表单并将它们连接在一起之后,我的行为变得非常奇
我是一名优秀的程序员,十分优秀!