Jeff,
Thanks for helping me with this. I did what you said and have the same
results. There is so little code that I wonder if this is some sort of a
configuration issue (global.asax) on my workstation. It is acting like it
just can't find the procedure when you click on an item in the tree. Here
is what I am doing... I hope you notice something I am doing wrong:
First I create a whole new web project in VS.NET with a VB back-end
I create a subfolder off the project called "XML" and drop in my XML file
I copy the Microsoft.Web.UI.WebControls.dll to the project's bin directory
I Rt. Click References, then "add reference" then browse to the project's
bin directory and select the Microsoft.Web.UI.WebControls.dll and click "OK"
I am not adding anything from the toolbar, I just add the following code to
the HTML tab in VS:
===================================================================
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="TreeviewTest.WebForm1"%>
<%@ Register TagPrefix="ie" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>HRReview</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="
http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form2" method="post" runat="server">
<ie:TreeView runat="server" ID="Treeview1" AutoPostBack="True"
onselectedindexchanged="SelectedIndexChanged">
<ie:TreeNode Expandable="CheckOnce" Expanded="True" Text="North America"
TreeNodeSrc="XML/employeetree.xml"></ie:TreeNode>
</ie:TreeView>
<asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 400px; POSITION:
absolute; TOP: 32px" runat="server"
Width="232px" Height="80px">Label</asp:Label>
</form>
</body>
</HTML>
===================================================================
Then I add some code to my 'code-behind' so it looks like this:
===================================================================
Imports System.Data.SqlClient
Imports Microsoft.Web.UI.WebControls
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Treeview1 As Microsoft.Web.UI.WebControls.TreeView
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Public Sub SelectedIndexChanged(ByVal sender As Object, ByVal e As
TreeViewSelectEventArgs)
Label1.Text =
Treeview1.GetNodeFromIndex(Treeview1.SelectedNodeIndex.ToString).Text
End Sub
End Class
===================================================================
When I run it, it shows the XML data fine, but will not get to the
SelectedIndexChanged procedure (which I have a stop set on)
Also: Can I add "key" elements to the XML file data to get key values into
the control? Or is there another way to pass index/key values that can be
passed when the user clicks on the control?
I hope this all helps. My deadline to get this done is by the end of the
month... so I still have a little time.
Scott
"Jeffrey Tan[MSFT]" said:
Hi Schoo,
Thanks for your feedback.
I feel strange that this event does not fire. I have tried your html code,
and added a breakpoint in SelectedIndexChange event handler.
This event does fire.
In my test I have removed all your xml related code and image url setting
code.
So I recommand you create a new empty project, then add a treeview control
onto the web form, then add the selecteditemchange event handler for it.
Then add a breakpoint in your selecteditemchange event handler to determine
if this event fires.
If it really does not fire, you can try to create a new C# project do the
same thing, to determine it this strange behavior happens again.
At last, if it does not fire, I think you can provide me your project to
reproduce this problem for me. I will try my best to help you.
===============================================================
Please apply my suggestion above and let me know if it helps resolve your
problem.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.