Treeview control

  • Thread starter Thread starter Schoo
  • Start date Start date
S

Schoo

I am successfully using the Microsoft.Web.UI.WebControls.dll but I can't get
the treeview control to run code when a node is selected. I read the msdn
online documentation and am doing this with code-behind in VB. Here is the
code that I am using:
===========================================
<ie:treeview runat="server" id="treeview1"
onselectedindexchanged="SelectedIndexChanged">
<ie:treenode ..../>
</ie.treeview>

Public sub SelectedIndexChanged(ByVal sender As Object, ByVal e As
TreeViewSelectEventArgs)
Label1.Text = "Selected " + e.NewNode.ToString + " (old Node index=" +
e.OldNode.ToString + ")"
End Sub
============================================
I need to fill a grid dynamically as a user clicks on an item. So, I need
an event that will respond and a way to use a key field so I can use that
information to pass to the grid. Any ideas or samples would be appreciated.

Scott
 
this post belongs in the microsoft.*.webcontrols forum. it does not apply to
framework
 
Hi Schoo,

Thanks for using Microsoft MSDN Managed Newsgroup.

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Hello Scott,

Thanks for your post. As I understand, the problem you are facing is that
you did not receive the event when a user selected an item in TreeView.
Please correct me if there is any misunderstanding. I performed the
research on my side, and notice that the event name should be
"onselectedindexchange" instead of "onselectedindexchanged" (there is an
extra letter 'd' at the end). Please change it and see if it works then.

I look forward to your result.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I am calling the procedure from the HTML code, so on the code-behind part,
it should run the procedure I am calling. Please reference the following
code:

===========================================
<ie:treeview runat="server" id="treeview1"
onselectedindexchanged="SelectedIndexChanged">
<ie:treenode ..../>
</ie.treeview>

Public sub SelectedIndexChanged(ByVal sender As Object, ByVal e As
TreeViewSelectEventArgs)
Label1.Text = "Selected " + e.NewNode.ToString + " (old Node index=" +
e.OldNode.ToString + ")"
End Sub
============================================

If I change the HTML to not make the call to the procedure and change the
procedure title as you suggest, it still does not get to the code when the
user clicks an item on the treeview:

===========================================
<ie:treeview runat="server" id="treeview1">
<ie:treenode ..../>
</ie.treeview>

Public sub onSelectedIndexChange(ByVal sender As Object, ByVal e As
TreeViewSelectEventArgs)
Label1.Text = "Selected " + e.NewNode.ToString + " (old Node index=" +
e.OldNode.ToString + ")"
End Sub
============================================

Please let me know what you think and if you have any sample codes I would
be happy to take a look at them.

Scott
 
Hello Scott,

Thanks for your reply. I reviewed your code again, it seems that you are
missing the AutoPostBack setting in the TreeView. Please refer to the
following information code on my side:

<ie:treeview id="TreeView1" style="Z-INDEX: 102; LEFT: 48px; POSITION:
absolute; TOP: 16px" runat="server" AutoPostBack="True"
onselectedindexchange="TreeView1_SelectedIndexChange"></ie:treeview>

Please let me know the result.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks for the response Tian. I have moved this issue to the
microsoft.public.dotnet.framework.aspnet.webcontrols. This issue is still
unresolved at this point, so please read through the issue there and let me
know if you have any ideas.

Scott
 
Back
Top