Filter Dataset

  • Thread starter Thread starter Steve Schroeder
  • Start date Start date
S

Steve Schroeder

Correct me if I'm wrong, but once I have my data returned from a stored
procedure, in a dataset and displayed in a DataGrid (ASP.Net)...I can filter
the data correct, without making a return trip to the server?

Anyone have an example of how this works?

Thanks
 
Steve,

Use a table("x").defaultview.rowfilter = "mycolumn = 'Steve'" for that

I hope this helps,

Cor
 
Thank you, I'll give that a shot. I'm assuming I can do 'like' expressions
also, not just 'equals'.
 
You are right.

Suppose you get data using sp(Select * from Employee ...)
to fill a dataset. Then you use following code

DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "Department = 'HR'";
datagrid.DataSource = dv; // only data in HR
datagrid.DataBind();

HTH

Elton Wang
(e-mail address removed)
 
The documentation for the DataColumn.Expression property provides details of
the syntax you can use for the DataView.RowFilter property.
 
Back
Top