Solved

DataSet filter

Posted on 2008-10-01
4
278 Views
Last Modified: 2013-12-17
I have dataset populated with all records from student_table  who are Active and Inactive status.
I want to filter this dataset and create another one with all records which are inActive.
how can it be achieved .. thanks in advance
0
Comment
Question by:dotnet0824
4 Comments
 
LVL 5

Expert Comment

by:libin_v
Comment Utility
You can use DataView.RowFilter
private void MakeDataView() 

{

   DataView dv = new DataView();
 

   dv.Table = DataSet1.Tables["Students"];

   dv.AllowDelete = true;

   dv.AllowEdit = true;

   dv.AllowNew = true;

   dv.RowFilter = "Status = 'Active'";

   dv.RowStateFilter = DataViewRowState.ModifiedCurrent;

   

   // Simple bind to a TextBox control

   Text1.DataBindings.Add("Text", dv, "StudentID");

}

Open in new window

0
 
LVL 3

Accepted Solution

by:
trunghieubkit earned 150 total points
Comment Utility
Do you want to create new DataSet that contains all records with Inactive status from the original DataSet?
0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 100 total points
Comment Utility
if your requirement is to simply populate the active students already fetched in the previous table to another gridview then its quite simple

DataView dv = ds.Tables["student_table].DefaultView;
dv.RowFilter = "IsActive = true";

gvActiveStudents.DataSource = dv;
gvActiveStudents..DataBind();
0
 

Author Comment

by:dotnet0824
Comment Utility
Raqi ur right.. Thats what i want. but can it be  a Dataset... DV is bound again . Can it be bound again to dataset. as I only know how to retrieve rows using Dataset
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now