J
James
Basically I have a DataGrid that I'm binding to the results of a stored
procedure call. The recordset is fairly small. Initially I'm creating a
DataSet from the results and binding it. There's a DropDownList on my page
that filters the records that are displayed in the grid.
How I'm currently handling this is when I initially bind, I create a
DataView from the table in the dataset. When the DropDownList changes
selection, I get the DataView from the Session variable (all of the original
data) and I create a DataTable that's a copy of the table within the
dataview. Then I loop through each DataRow in the DataTable and do
dr.Delete() on the records that don't meet the criteria, and rebind to the
DataTable. This seems really hokey. Is there a better way to do this
without having to jump through all of these hoops just to filter a dataset?
The reason I create the DataTable as a copy is because if I delete the
records from the DataView, it seems to affect the original dataset, which
I'm trying to keep intact.
:
:
Thanks
procedure call. The recordset is fairly small. Initially I'm creating a
DataSet from the results and binding it. There's a DropDownList on my page
that filters the records that are displayed in the grid.
How I'm currently handling this is when I initially bind, I create a
DataView from the table in the dataset. When the DropDownList changes
selection, I get the DataView from the Session variable (all of the original
data) and I create a DataTable that's a copy of the table within the
dataview. Then I loop through each DataRow in the DataTable and do
dr.Delete() on the records that don't meet the criteria, and rebind to the
DataTable. This seems really hokey. Is there a better way to do this
without having to jump through all of these hoops just to filter a dataset?
The reason I create the DataTable as a copy is because if I delete the
records from the DataView, it seems to affect the original dataset, which
I'm trying to keep intact.
:
Thanks