I had a problem getting the total number of rows for items displayed in the Gridview, using Paging and with the LinqDataSource as the data source.
I tried several approaches:
protected void GridDataSource_Selected(object sender, LinqDataSourceStatusEventArgs e)
{
totalLabel.Text = e.TotalRowCount.ToString();
}
returns -1 every time.
protected void LinqDataSource1_Selected(object sender, LinqDataSourceStatusEventArgs e)
{
System.Collections.Generic.List<country> lst = e.Result as System.Collections.Generic.List<country>;
int count = lst.Count;
}
gives me only the score for the current page, not the total.
Any other suggestions?
source
share