得到的GridView寻呼机记录的总NO [英] Get Total No of Records in Gridview Pager
本文介绍了得到的GridView寻呼机记录的总NO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在GridView控件的页脚记录在总数。的我有来源,但它没有显示我纠正无记录。它显示了一切正确的。只需在总记录为没有显示正确
< PagerTemplate>
显示
&所述;%= grdProductStock.PageIndex * grdProductStock.PageSize + 1%GT;
至
&所述;%= grdProductStock.PageIndex * grdProductStock.PageSize + grdProductStock.Rows.Count%GT;
的
&所述;%= grdProductStock.PageCount * grdProductStock.Rows.Count%GT;
记录
< / PagerTemplate>
解决方案
试试这个,我发现一些地方虽然在很久以前google搜索。
保护无效grdProductStock_DataBound(对象发件人,EventArgs的发送){
如果(grdProductStock!= NULL)
{
//显示搜索结果计数
//从一个GridView得到最高寻呼机行
GridViewRow排= grdProductStock.TopPagerRow;
如果(行!= NULL)
{
//在我的当前页面添加条创建一个CELL
TableCell的infocell =新的TableCell();
infocell.Text =页面+(grdProductStock.PageIndex + 1)的ToString()+的+ grdProductStock.PageCount.ToString()+(+ table.Rows.Count.ToString()+记录) ; //获取表,它表明PagingStrip
表TBL =(表)row.Cells [0] .Controls [0]; //会发现表
tbl.Rows [0] .Cells.Add(infocell);
}
}
}
下面表格是你的数据源,即dataset.tables [0] .rows.count。 datatable.rows.count等。
How to get the total number of records in the footer of gridview. i have the source but it is not showing me correct no of records. It shows everything else correct. Just the total records is not showing correct.
<PagerTemplate>
Showing
<%= grdProductStock.PageIndex * grdProductStock.PageSize + 1%>
to
<%= grdProductStock.PageIndex * grdProductStock.PageSize + grdProductStock.Rows.Count%>
of
<%= grdProductStock.PageCount * grdProductStock.Rows.Count%>
Records
</PagerTemplate>
解决方案
Try this, I found it some where while googling a long time ago.
protected void grdProductStock_DataBound(object sender, EventArgs e) {
if (grdProductStock!= null)
{
//Showing Search Result Count
//Get Top Pager Row from a gridview
GridViewRow row = grdProductStock.TopPagerRow;
if (row != null)
{
//Create one Cell for adding in my current paging strip
TableCell infocell = new TableCell();
infocell.Text = " Page " + (grdProductStock.PageIndex + 1).ToString() + " of " +grdProductStock.PageCount.ToString() +"(" + table.Rows.Count.ToString() + " Records)";
//Getting table which shows PagingStrip
Table tbl = (Table)row.Cells[0].Controls[0];
//Will Find table
tbl.Rows[0].Cells.Add(infocell);
}
}
}
Here table is your datasource i.e., dataset.tables[0].rows.count. datatable.rows.count etc.
这篇关于得到的GridView寻呼机记录的总NO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文