Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering a Datagrid

Status
Not open for further replies.

tsp1lrk

IS-IT--Management
May 30, 2001
103
US
Hello,

I've been struggling for 3 days on this, while I've found some info on it, I'm getting more confused. My scenario is:

I have a dropdown list with Locations, you choose a location, then on selectindexchanged, a datagrid appears with info pertaining to that selection, based on a certain code. Fine, that works. Now I have another dropdown list with some Filters: Region, District, Location. When you choose Region, I want to filter the datagrid and show all the regions associated with that code. That's where I'm having a problem. How do I do this?? I found one example, which totally confused me more. HELP!!! Do I use case statements, etc? I'm not sure how to approach using a dropdown list to filter out data in the grid. Can anyone assist?
Thanks,
Lisa
UPS
 
load the data source for the datagrid into a dataview. set the dataview as the datasource to the datagrid.
Code:
Dim V as DataView

'get dataset for datagrid

V = New Dataview(DataSet.DataTable([table name])
V.RowFilter = "[Column Name] = '" & ComboBox.SelectedValue & "'"
V.RowFilterState = DataViewRowState.CurrentRows
DataGrid.DataSource = V

Jason Meckley
Database Analyst
WITF
 
Hi, Thanks...

Does this occur in the Databind section or in the OnSelectIndexChanged part of the dropdown?

Lisa
UPS
 
Is there a way to do Multiple filters with multiple rows?

Thanks-
Lisa
 
I would think you can do multiple filters, but I have not done this before.

Jason Meckley
Database Analyst
WITF
 
The rowfilter and sort properties act sort of like a Where and order by statement in SQL do. Just and an "AND" or "OR" to filter by multiple rows.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top