Filter MasterDetail datagrids?

G

Guest

dfjhsqd asked this earlier in the week and I have the same question.
How can I apply a filter to the Master table when using two datagrids
in a MasterDetail relationship?
 
B

Brad Shook

set the datagrids datasource to the dataview of the dataset. If you do this
you can set the dataview filter property.

Ex.
Me.DataSetWellMobile1.Relations.Add( _
New DataRelation( _
relationName:="relWellInfo", _
parentColumn:=Me.DataSetWellMobile1.Tables("TblPeople").Columns("UniqueId"),
_
childColumn:=Me.DataSetWellMobile1.Tables("TblWellMobileInfo").Columns("Pers
onId"), _
createConstraints:=True))

Me.DGWellResults.DataBindings.Add(New Binding("DataSource",
Me.DataSetWellMobile1.TblPeople.DefaultView, "relWellInfo"))
Me.DataSetWellMobile1.TblPeople.DefaultView.RowFilter="Name"

Or

Me.DGWellResults.Datasource=Me.DataSetWellMobile1.TblPeople.DefaultView
Me.DataSetWellMobile1.TblPeople.DefaultView.RowFilter="Name"

Brad
 

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

Top