Cascading DropDown Gridview

sullyman

Active member
Joined
Nov 11, 2009
Messages
37
Programming Experience
Beginner
Hi folks,

I've managed to get the following code working for 2 dropdowns following this article - XtraGrid Suite - E898 - How to filter a second LookUp column based on a first LookUp column's value - View Example

I would now like to include a third dropdown so the first will populate the second dropdown, then the first and second dropdown list added together will populate the third dropdown etc. The third dropdown column will be Location. (So user picks Year, then course, then location etc.)

I think i have to add it somehow to this line in the code below but i don't know the syntax to add this .

clone.RowFilter = "[YearID] = " & row("YearID").ToString()

Here is my code below which works great.




Private Sub gridView1_ShownEditor(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.ShownEditor
Dim view As DevExpress.XtraGrid.Views.Grid.GridView
view = TryCast(sender, DevExpress.XtraGrid.Views.Grid.GridView)
If view.FocusedColumn.FieldName = "CPDCourseID" AndAlso TypeOf view.ActiveEditor Is DevExpress.XtraEditors.GridLookUpEdit Then
Dim edit As DevExpress.XtraEditors.GridLookUpEdit
edit = CType(view.ActiveEditor, DevExpress.XtraEditors.GridLookUpEdit)

Dim CPD As BindingSource = CType(edit.Properties.DataSource, BindingSource)
Dim table As DataTable = (CType(CPD.DataSource, DataSet)).Tables(CPD.DataMember)
clone = New DataView(table)
Dim row As DataRow = view.GetDataRow(view.FocusedRowHandle)
clone.RowFilter = "[YearID] = " & row("YearID").ToString()
edit.Properties.DataSource = New BindingSource(clone, "")
End If
End Sub
 
Back
Top