我有一个treeview asp.net控件。我有以下SelectedNodeChanged事件的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
当我点击一个节点时,如果它不是“root”,它会显示2个按钮,如果我点击按钮btnCreateUser,它会转到一个页面“user.aspx”,这是btnCreateUser的postbackurl。 / p>
这很好。 但是当下次单击“Root”以外的节点时,它会直接转到postbackurl页面“User.aspx”,即使我没有单击Button btnCreateUser。
在我第一次点击“btnCreateUser”后,这种情况只发生过一次。
有人可以帮忙吗?