【发布时间】:2018-01-26 10:08:25
【问题描述】:
我的记录显示需要序列号。每页 50 条记录。
public List<string[]> InstructionsData(IEnumerable<Assets> InstructionsEntry, int currentUserId)
{
return InstructionsEntry.Select((entry,index) => new string[]
{
(index + 1).ToString(),
entry.state_Id,
entry.batchRef_Id,
entry.assetCategory_Id,
GetAge(entry.age),
entry.assetStatus_Id,
GetStatusTag(entry.recordStatus ??false),
entry.availbaleQty.ToString(),
entry.createdBy,
}).ToList();
上面用于显示索引的代码工作正常。我的问题是当我移动到下一页时,索引再次从第一页开始。请帮我在下一页继续索引号。
【问题讨论】:
-
您将不得不使用 linq skip 和 take 命令,但您的函数结构错误,因为它不使用索引进行分页。尝试重新格式化您的问题和方法。