我在 gridview 中显示的结果与调试时显示的结果不同。
有一个用于过滤结果的网格视图的搜索,它似乎只在数字低于几百时才有效。
例如,搜索rank
, whererank =='10'
结果存储过程总计 607 和 all rank == 10
。linq to sql 调试结果完全一样。
当结果绑定到 gridview 并显示时,它们似乎是正确的,直到您到达显示结果的第 10 页,然后结果不正确,这意味着rank != 10
对于较小的结果集,结果似乎是正确的。不知道发生了什么。
这是代码
DataTable getEmployeeResults = employee.FullEmployeeRoster();
var results = (from row in getEmployeeResults.AsEnumerable()
select new EmployeeRow
{
EmployeeId = row.Field<int?>("EmployeeID"),
Rank = row.Field<string>("Rank"),
Name = row.Field<string>("Name"),
WorkEmail = row.Field<string>("Email"),
DutyStation = row.Field<string>("StationName"),
Directorate = row.Field<string>("Directorate"),
BranchService = row.Field<string>("Branch"),
Active = ConvertToBool(row.Field<int>("Active"))
});
if (this.ddRank.SelectedValue != "")
{
results = results.Where(x => x.Rank == this.ddRank.SelectedItem.Text);
}
if (this.chkInactive.Checked)
{
results = results.Where(x => x.Active == false);
}
else
{
results = results.Where(x => x.Active == true);
}
this.gridEmployees.DataSource = results.ToList();
this.gridEmployees.DataBind();