Got it thanks! // Serviced component Punch.EmployeePunchDetail emp = new Punch.EmployeePunchDetail(); // Serviced component returns a dataset with two tables and one relation defining master-detail DataSet ds = emp.getPunches(txtFromDate.Text, txtToDate.Text); DataViewManager dvm = new DataViewManager(ds); // set filter and bind to grid dvm.DataViewSettings["EmployeePunchSummary"].RowFilter = txtFilter.Text; dataGridMaster.SetDataBinding(dvm, "EmployeePunchSummary");
-----Original Message----- From: Mark Boulter [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 1:16 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Master Detail With RowFilter You need to use a DataViewManager - when you bind to a DataSet/DataTable combination we generate DataViews on the fly we don't use the DefaultView. Look up DataViewManager in the MSDN docs mark -----Original Message----- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Potter, Mark S. Sent: Thursday, October 14, 2004 12:17 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Master Detail With RowFilter I was never able to get the filter to work with the System.Windows.Forms.DataGrid. But I was able to get the filtering to work with a master detail dataset using the true database grid from http://www.componentone.com/ private DataSet m_dsGrid = null; private const string MASTER_TABLE = "EmployeePunchSummary"; . private void bindGrid() { try { // Serviced component Punch.EmployeePunchDetail epd = new Punch.EmployeePunchDetail(); m_dsGrid = epd.getPunches(txtFromDate.Text, txtToDate.Text); // Bind the dataset to the grid using the default view of the master table c1TrueDBGrid1.DataSource = m_dsGrid.Tables[MASTER_TABLE].DefaultView; c1TrueDBGrid1.DataMember = MASTER_TABLE; . . private void applyFilter (string filter) { try { if (null != m_dsGrid) m_dsGrid.Tables[MASTER_TABLE].DefaultView.RowFilter = filter; . . This allows for complex filters to be applied on the cached ds. Thanks, Mark Potter -----Original Message----- From: Potter, Mark S. Sent: Wednesday, October 13, 2004 3:19 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Master Detail With RowFilter I wrote a little test app to try to get row filtering to work with a master detail hierarchical data set. Has anyone done this? private DataSet ds = null; private void bindGrid() { try { // Serviced component Punch.EmployeePunchDetail emp = new Punch.EmployeePunchDetail(); // returns a dataset with two data tables and one relation defining master-detail ds = emp.getPunches(txtFromDate.Text, txtToDate.Text); // bind to master and detail grids (System.Windows.Forms.DataGrid), this works fine dataGridMaster.SetDataBinding(ds, "EmployeePunchSummary"); dataGridDetail.SetDataBinding(ds, "EmployeePunchSummary.EmployeeDetail"); } catch (SqlException ex) { showError(ex); } } private void applyFilter () { try { if (ds != null) { ds.Tables["EmployeePunchSummary"].DefaultView.RowFilter = txtFilter.Text; // filter does not seem to work for hierarchical datasets, but works fine when a single table is bound to the grid } } catch (SqlException ex) { showError(ex); } } =================================== This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com
