问题描述
我目前正在使用 GridView 来显示表格数据.我需要合并第一列中具有相同值的单元格.目前我在 PreRender
事件中有代码可以为我设置 RowSpan
属性,它工作正常.
I am currently using GridView to display tabular data. I need to merge cells in the first column that have equal values. At the moment I have code in the PreRender
event to set the RowSpan
property for me, and it's working fine.
问题是我不能使用分页,因为页面会在第一个字段相等的部分中间拆分.
The problem is I cannot use paging, since the pages will split in the middle of a section where the first field is equal.
我希望分页的记录计数为每个合并的行计数一个,而不是每个子行一个.
I want the record count for paging to count one for each of the merged rows, rather than one for each sub-row.
GridView 或其他一些 jQuery 网格可以做到这一点吗?
Is this possible with GridView or some other jQuery grid?
推荐答案
for (i = PagSize; i <= dt.Rows.Count; i++)
{
Curr = dt.Rows[i - 1]["Brand"].ToString();
if (i < dt.Rows.Count)
{
Nxt = dt.Rows[i]["Brand"].ToString();
diff = dt.Rows.Count - i;
if (Curr != Nxt)
{
DctPaging.Add(PageNum, i);
PageNum = PageNum + 1;
i = i + PagSize;
if (i >= dt.Rows.Count)
{
DctPaging.Add(PageNum, i);
break;
}
}
}
}
参考点击这里
这篇关于具有合并行的 ASP.net 网格分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!