We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Filtering datasource

Thread ID:

Created:

Updated:

Platform:

Replies:

21551 Nov 14,2004 03:35 PM Nov 15,2004 02:07 AM Windows Forms 4
loading
Tags: GridControl
Bernard Herrok
Asked On November 14, 2004 03:35 PM

I''ve got a grouping grid with 3 bound columns and 1 unbound. The 2nd column and the unbound column celltype is a combobox with a bound dataset. I''d like for when the unbound column changes, for it to filter the 2nd column''s combobox resultset. So effectively, every row could have a different filter. Thanks!

Bernard Herrok
Replied On November 14, 2004 03:38 PM

Here''s what i''ve got now. But it doesn''t seem to do anything. Private Sub ExpensesGroupDG_TableControlCurrentCellChanged(ByVal sender As Object, ByVal e As Grouping.GridTableControlEventArgs) Handles ExpensesGroupDG.TableControlCurrentCellChanged Dim colIndex As Integer = e.TableControl.CurrentCell.ColIndex Dim rowIndex As Integer = e.TableControl.CurrentCell.RowIndex '' UnBound ComboBox Dim currComboBox As Grouping.GridTableCellStyleInfo = e.TableControl.Model(rowIndex, colIndex) '' Desired column to be filtered Dim currSubAccount As Grouping.GridTableCellStyleInfo = e.TableControl.Model(rowIndex, colIndex - 2) currSubAccount.CellType = "ComboBox" '' Call stored procedure with unbound combobox value '' return the datatable currSubAccount.DataSource = RemoteFactory.PropertyService.VOExpenseGroupSubAccountList(currComboBox.CellValue).VORecoverableExpenseGroupSubAccountsList currSubAccount.ValueMember = "GLAccountId" currSubAccount.DisplayMember = "SubAccountCode" currSubAccount.DropDownStyle = GridDropDownStyle.Exclusive End Sub

Administrator [Syncfusion]
Replied On November 14, 2004 07:05 PM

Here is a little sample where the datasource for the combobox in "Col2" is filtered by the value in the ComboBox within the "unbound" column. GGC_UnboundComboBox_6641.zip

Bernard Herrok
Replied On November 14, 2004 08:46 PM

I don''t quite understand the QueryValue and SaveValue handlers. Why do you call them and why would i need to call them. Apart from what i can see (the unbound combobox doesn''t hold the selected value) how would i change it to use my dataset?

Administrator [Syncfusion]
Replied On November 15, 2004 02:07 AM

QueryValue and SaveValue is how the sample is providing the unbound data to the unbound column. Comment them out and you will see that the unbound column does not display/save any data. Here is the code that sets up the unbound column to hold a combobox. You would use your DataSource/DisplayMember/ValueMember here. GridTableCellStyleInfo style = this.gridGroupingControl1.TableDescriptor.Columns["unbound"].Appearance.AnyRecordFieldCell; style.CellType = "ComboBox"; //.... get the DataSource datatable into dt1 style.DataSource = dt1; // a datatable style.DisplayMember = "value"; //column in datatable style.ValueMember = "value"; //column in datatable In the sample, if you change the value in the combobox on the right, and then drop the combobox in the middle, the dropped list has been filtered by the value from the right combobox.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;