24minutes 0 Newbie Poster

Greeting,

I'm working on a VB.NET program. Currently I'm facing difficulty of filtering data of the parent and the child.

I use GridControl from DevExpress through :)/>

This is the code of how I populate my TreeView :

Public Sub fillTreeView(ByVal Key As String, ByVal Txt As String, ByVal N As TreeNode, ByVal sender As Object)
    Dim TN As TreeNode

    If N Is Nothing Then 'if no node
        TN = sender.Nodes.Add(Key, Txt) 'then this will be parent node, create the node
    Else
        TN = N.Nodes.Add(Key, Txt) 'use the node to add a child node
    End If

    'get the children of current node
    Dim getCategoryParent As New OleDbCommand("SELECT * FROM tblCategory WHERE cat_parent_id = ?", conn)
    getCategoryParent.Parameters.AddWithValue("cat_parent_id", Key)

    Dim sdr = getCategoryParent.ExecuteReader
    'recursive
    Do While sdr.Read()
        fillTreeView(sdr("cat_id"), sdr("cat_name"), TN, Nothing)
    Loop
    sdr.Close()
    getCategoryParent.Dispose()
End Sub

Look at the screenshot here : http://puu.sh/9IBcm/491864de17.png

I have Shoes as a "Parent" category, when I click on "Shoes" the GridView will filter accordingly, below is the code fragment I used :

StockGV.ActiveFilter.NonColumnFilter = "[cat_name] = '" & tvCategory.SelectedNode.Text & "'"

But it only filter ONE CATEGORY. Well now my problem is, since "Casual" is the child of "Shoes", so I want it that when I click on "Shoes", it will filter "Shoes" and "Casual".

In other word, when I click on the parent, it shows everything under it too.

What approach can I use to achieve this? Please advice.

Thanks!