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. Image for the cookie policy date

Filtering datasource

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!

4 Replies

BH Bernard Herrok November 14, 2004 08:38 PM UTC

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


AD Administrator Syncfusion Team November 15, 2004 12:05 AM UTC

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


BH Bernard Herrok November 15, 2004 01:46 AM UTC

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?


AD Administrator Syncfusion Team November 15, 2004 07:07 AM UTC

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.

Loader.
Live Chat Icon For mobile
Up arrow icon