Re: dynamic treeview problem
I have the code to retrieve values from the database and display on the treenode dynamically.
Just the selection is a problem.
If there is a tutorial of any other information please let me kow
Re: dynamic treeview problem
Is there no 1 who knows the answer to this?/?
Even how to go about information will do.
Re: dynamic treeview problem
Dear Jagmit,
I dont have idea about c#, but I tell u what I have done in vb.net.
I have created a table where I have kept all the menus (parent nodes and child nodes).
table structure is like this:
menuId- MenuName- menuLevel-FormId
menuLevel keeps an integer value of parent(1 level) or and chile(2 level or 3 level)
I have another table in which I have kept all my forms (along with unique form id).
when the form is loaded, the tree is filled and menu id is assigned to each tree nodes as below:
nodeAuthor.value = Trim(reader("MenuId").ToString)
when ever user clicks any menu the value is assigned to a global variable(session variable) as below
Sub MenuSelected(ByVal sender As Object, ByVal e As EventArgs)
Session("VpMnuItem") = VisaProDetMenu.SelectedNode.Value
end sub
I have writen one query, which picks the form id from menus table and formName from 'forms' table as below:
SELECT a.MenuId, b.FormId, b.FormName FROM T_LT_Menus a LEFT OUTER JOIN "
T_LT_FormsReports b ON a.FormFid = b.FormId
Where a.MenuId='" & Session("VpMnuItem") & "' "
I have used following syntax to open a new page
MyConn.Open()
Dim Cmd As New SqlCommand(strSQL, MyConn)
Dim reader As SqlDataReader = Cmd.ExecuteReader()
If reader.HasRows Then
reader.Read()
If Trim(reader("FormId").ToString) > 0 Then
Session("VpFormId") = Trim(reader("FormId").ToString)
pageToDisplay = Trim(reader("FormName").ToString)
Else
pageToDisplay = "NONE"
End If
Else
pageToDisplay = "NONE"
End If
reader.Close()
MyConn.Close()
Catch Ex As Exception
MsgBox(Ex.Message.ToString)
End Try
If pageToDisplay <> "NONE" Then
Response.Redirect(pageToDisplay)
End If
if it helps u, please let me know.