Private Sub loadtreeview(ByVal e As Telerik.WebControls.RadTreeNodeEventArgs)
Dim DS As New DataSet()
Dim cmd As New SqlCommand()
Dim i As Int32
Dim odataadapter As New SqlDataAdapter()
If e.NodeClicked.Value = 1 Then
e.NodeClicked.Expand()
End If
If e.NodeClicked.Value = 2 Then
cmd = New SqlCommand()
If oConnection.State = ConnectionState.Closed Then oConnection.Open()
cmd.Connection = oConnection
cmd.CommandText = "SELECT * from tbl_subcutegory WHERE cutegory ='" & e.NodeClicked.Text.ToString & "'"
odataadapter = New SqlDataAdapter(cmd)
odataadapter.Fill(DS)
oConnection.Close()
If DS.Tables(0).Rows.Count > 0 Then
e.NodeClicked.Nodes.Clear()
For i = 0 To DS.Tables(0).Rows.Count - 1
Dim childNode As RadTreeNode = CreateNode(textreplace(Trim(DS.Tables(0).Rows(i).Item("subcutegory"))), False)
childNode.Value = 3
e.NodeClicked.AddNode(childNode)
Next i
e.NodeClicked.Expand()
End If
End If
If e.NodeClicked.Value = 3 Then
cmd = New SqlCommand()
If oConnection.State = ConnectionState.Closed Then oConnection.Open()
cmd.Connection = oConnection
cmd.CommandText = "SELECT * from tbl_subjects WHERE subcutegory ='" & e.NodeClicked.Text.ToString & "'"
odataadapter = New SqlDataAdapter(cmd)
odataadapter.Fill(DS)
oConnection.Close()
If DS.Tables(0).Rows.Count > 0 Then
e.NodeClicked.Nodes.Clear()
For i = 0 To DS.Tables(0).Rows.Count - 1
Dim childNode As RadTreeNode = CreateNode(textreplace(Trim(DS.Tables(0).Rows(i).Item("subject"))), False)
childNode.Value = 4
childnode.href = "show.aspx?id=" & Trim(DS.Tables(0).Rows(i).Item("ID")) & "&word=" & Trim(DS.Tables(0).Rows(i).Item("subject"))
childNode.Target = "show"
e.NodeClicked.AddNode(childNode)
Next i
e.NodeClicked.Expand()
End If
End If
End Sub