Filering content using either gridview or listview

calibreinc
calibreinc used Ask the Experts™
on
Hello all,

can i use either gridview or listview to filter data from a datatable in VS2010 using an access database. my example is i have a table showing different employees and agencies they work for and i just want to pick an agency and show all the employees in that selected agency if that makes sense.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
MIS Liason
Most Valuable Expert 2012
Commented:
Not sure, but in some sense you have to make a query (or view, or whatever) the source for this GridView or Listview

Something like this roughly:
SELECT tblEmp.AgencyID, tblEmp.EmpID
FROM tblAngency INNER JOIN tblEmps ON tblAgency.AgencyID=tblEmps.AgencyID
WHERE tblEmp.AgencyID= [SomeValue]
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012
Commented:
or this:
SELECT tblAgency.AgencyID, tblEmp.EmpID
FROM tblAgency INNER JOIN tblEmp ON tblAgency.AgencyID = tblEmp.AgencyID
WHERE tblAgency.AgencyID=[SomeValue]

So in either case you will have a control that selects the AgencyID, then the SQL looks at this value as it's criteria.
Then the SQL filters the resulting dataset accordingly.
Then this dataset (or query, or view ,or whatever...) will be the source for the gridview or listview
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Thanks,

Glad I could help.

;-)

Jeff

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial