Filter Datagrid?

J

Jason .

I have 3 datagrids on my page that uses data from one stored proc. The
data is sorted by category (3 categories). Can I use the data from
mystored proc to fill the datagrid without having to create three trips
to the server to load the data?

in pseudocode:

If category = 1 then load that data into grid 1

If category = 2 then load that data into grid 2

If category = 3 then load that data into grid 3

Thanks.
 
J

Jason .

I don't know if this is the best way to go about it but I was able to
figure it out...

// Create dataviews to hold the table to filter
DataView dv1 = new DataView(ds.Tables["Results"]);
DataView dv2 = new DataView(ds.Tables["Results"]);
DataView dv3 = new DataView(ds.Tables["Results"]);
DataView dv4 = new DataView(ds.Tables["Results"]);
DataView dv5 = new DataView(ds.Tables["Results"]);

dv1.RowFilter = "SortId = 0";
dv2.RowFilter = "SortId = 1";
dv3.RowFilter = "SortId = 2";
dv4.RowFilter = "SortId = 3";
dv5.RowFilter = "SortId = 5";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top