Linqdatasourceにバインドされたフィルタリングとページ付け(一度に10)を備えたGridViewがあります。これはすべて機能します。
しかし、すべての行の取得が完了した後、LinqDataSourceで取得されたすべてのデータのIDを取得するにはどうすればよいですか?
このメソッドがあり、e.Resultはこのグリッドのリストを含むオブジェクトデータ型です
protected void LinqDataSource_Selected(object sender, LinqDataSourceStatusEventArgs e) // event fires after data retrieval complete.
{
List<int> ids = new List<int>();
if (e.TotalRowCount > 0)
{
for (int idx = 0; idx < e.TotalRowCount; idx++)
{
Foo foo = (Foo)(e.Result[idx]); // error cannot apply indexing to expression of type object
ids.Add(foo.Id);
}
}
}
私のエラーはオブジェクトを反復処理していますが、これはどのように行うことができますか?