I have a treeview asp.net control. And I have the following SelectedNodeChanged Event ofr Treeview1.
Private Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.SelectedNodeChanged
Try
Dim type As Boolean = False
Dim nodetext As String = TreeView1.SelectedNode.Value
Dim depth As Integer = TreeView1.SelectedNode.Depth
If nodetext = "Root" Then
btnCreateComp.Visible = True
btnCreateComp.Text = "Create Company"
btnCreateUser.Visible = False
Else
type = getNodeType(nodetext)
'if it is true its USER
'if false it is COMPANY
If type = True Then
btnCreateComp.Visible = False
btnCreateUser.Visible = True
btnCreateUser.Text = "Edit User"
btnCreateUser.PostBackUrl = "~/Account/User.aspx"
Else
btnCreateComp.Visible = True
btnCreateComp.Text = "Edit Company"
btnCreateUser.Visible = True
btnCreateUser.Text = "Create User"
btnCreateUser.PostBackUrl = "~/Account/User.aspx"
End If
End If
Catch ex As Exception
End Try
End Sub
When I click on a node, and if it is not "root", it makes 2 buttons visible, if I click the button btnCreateUser , it goes to a page "user.aspx", which is postbackurl for btnCreateUser.
This is fine. But when the next time a click a node other than "Root", it directly goes to the postbackurl page "User.aspx", even though I have not clicked on the Button btnCreateUser.
And this happens only once after the first time I have clicked "btnCreateUser".
Can anyone please help?