473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

TreeView: OnSelectedNodeChanged not firing??

With this TreeView declaration:

<asp:TreeView ID="Cloner" runat="server"

SelectedNodeStyle-Font-Bold="true" SelectedNodeStyle-ForeColor="#003E21"

OnTreeNodePopulate="PopulateNode" OnSelectedNodeChanged="SelectNode"

ExpandDepth="0">

</asp:TreeView>

Nodes are added in PopulateNode() like so:

protected void PopulateNode(Object source, TreeNodeEventArgs e)

{

TreeNode newNode = null;

switch (e.Node.Depth)

{

case 0:

string locationIdStr = e.Node.Value;

try

{

int locationId = Convert.ToInt32(locationIdStr);

e2006TableAdapters.MenusTableAdapter mta = new e2006TableAdapters.MenusTableAdapter();

mta.FillByLocationId(myDto.Menus, locationId);

foreach (e2006Table.MenusRow menuRow in myDto.Menus)

{

newNode = new TreeNode(menuRow.MenuName, menuRow.MenuId.ToString());

newNode.SelectAction = TreeNodeSelectAction.Expand;

newNode.PopulateOnDemand = true;

e.Node.ChildNodes.Add(newNode);

}

}

catch { }

break;

// etc

And, finally, the leaf nodes are added with this code:

foreach (e2006.MenuItemsRow menuItems in myDto.MenuItems)

{

newNode = new TreeNode(menuItems.Name, menuItems.MenuItemId.ToString());

newNode.SelectAction = TreeNodeSelectAction.Select;

newNode.NavigateUrl = "";

e.Node.ChildNodes.Add(newNode);

}

The question is: WHY doesn't the OnSelectedNodeChanged="SelectNode"

protected void SelectNode(Object source, EventArgs e)

{ // This never fires!!!???!!!

TIA,

geo

Dec 16 '05 #1
5 9445
Hi geo,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 17 '05 #2
Kevin, Is this issue still open?

Thanks
geo

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:kV****************@TK2MSFTNGXA02.phx.gbl...
Hi geo,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 21 '05 #3
Hi Geo,

Sorry for keep you waiting. As for the dynamically added TreeNode's
Selected event not fire problem, based on my research , it is due to the
TreeNode.SelectAction you set in the original code...

In order to make the "TreeNodePopulated" and "SelectedNodeChanged" event
get fired for your new created nodes, we should set their SelectAction to
"SelectExpand", e.g:

================================

protected void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs
e)
{
string name = e.Node.Text;
TreeNode node = null;
if (e.Node.ChildNodes == null || e.Node.ChildNodes.Count == 0)
{
for (int i = 0; i < 5; i++)
{
node = new TreeNode(name + i, name + i);
node.SelectAction = TreeNodeSelectAction.SelectExpand;
node.PopulateOnDemand = true;

e.Node.ChildNodes.Add(node);
}
}
}
=====================================

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Dotnet Gruven" <do**********@newsgroup.nospam>
| References: <eg**************@TK2MSFTNGP11.phx.gbl>
<kV**************@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: TreeView: OnSelectedNodeChanged not firing??
| Date: Wed, 21 Dec 2005 09:03:24 -0500
| Lines: 19
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <OH**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-128-25-74.hsd1.ma.comcast.net 24.128.25.74
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:366235
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Kevin, Is this issue still open?
|
| Thanks
| geo
|
| "Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
| news:kV****************@TK2MSFTNGXA02.phx.gbl...
| > Hi geo,
| >
| > We have reviewed this issue and are currently researching on it. We will
| > update you ASAP. Thanks for your patience!
| >
| > Kevin Yu
| > =======
| > "This posting is provided "AS IS" with no warranties, and confers no
| > rights."
| >
|
|
|

Dec 21 '05 #4
Dear Sir,

I would like to check if the dynamically load nodes can still fire the

onselectednodechanged. Even if I changed to SelectExpand, it still does
not work. My code

is as follows. Please help. Thanks.

best regards,

Edward

<ASP:TreeView id="TreeView1" OnTreeNodePopulate="TreeNodePopulate"

OnSelectedNodeChanged="TreeNodeSelectedNodeChanged " ExpandDepth="0"
EnableViewState="false"

Visible=False ShowLines="true" runat="server"></ASP:TreeView>

Sub TreeNodeSelectedNodeChanged(ByVal sender As Object, ByVal e
As EventArgs)
Value = TreeView1.SelectedNode.Value
Text = TreeView1.SelectedNode.Text
TreeView1.Visible = False
End Sub
Sub TreeNodePopulate(ByVal sender As Object, ByVal e As
TreeNodeEventArgs)
SetDV()
Dim nodes As DataView = GetChilds(DV, e.Node.Value)
' Populate Treeview.
For Each row As DataRowView In nodes
Dim newNode As New TreeNode()
newNode.Text = row("description").ToString()
newNode.Value = row("code").ToString()
'If Not IsNumeric(newNode.Value) Then
newNode.SelectAction = TreeNodeSelectAction.SelectExpand
newNode.PopulateOnDemand = True
'End If
e.Node.ChildNodes.Add(newNode)
'AddChild(DV, headNode)
Next
End Sub
*** Sent via Developersdex http://www.developersdex.com ***
May 29 '06 #5

Dear Sir,

I would like to check if the dynamically load nodes can still fire the

onselectednodechanged. Even if I changed to SelectExpand, it still does
not work. My code

is as follows. Please help. Thanks.

best regards,

Edward

<ASP:TreeView id="TreeView1" OnTreeNodePopulate="TreeNodePopulate"

OnSelectedNodeChanged="TreeNodeSelectedNodeChanged " ExpandDepth="0"
EnableViewState="false"

Visible=False ShowLines="true" runat="server"></ASP:TreeView>

Sub TreeNodeSelectedNodeChanged(ByVal sender As Object, ByVal e
As EventArgs)
Value = TreeView1.SelectedNode.Value
Text = TreeView1.SelectedNode.Text
TreeView1.Visible = False
End Sub
Sub TreeNodePopulate(ByVal sender As Object, ByVal e As
TreeNodeEventArgs)
SetDV()
Dim nodes As DataView = GetChilds(DV, e.Node.Value)
' Populate Treeview.
For Each row As DataRowView In nodes
Dim newNode As New TreeNode()
newNode.Text = row("description").ToString()
newNode.Value = row("code").ToString()
'If Not IsNumeric(newNode.Value) Then
newNode.SelectAction = TreeNodeSelectAction.SelectExpand
newNode.PopulateOnDemand = True
'End If
e.Node.ChildNodes.Add(newNode)
'AddChild(DV, headNode)
Next
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
May 29 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: cyriel1920 | last post by:
Hi, I use the selectednodestyle with a white background so the user can see which item was chosen in the treeview navigation. The nodes have a navigateURL with a target to another frame....
4
by: hartbypass | last post by:
Hello, I have treeview control that I am populating with a XML file. The structure is: Treenode Level 1 Item1 Item2 Item3
0
by: drop | last post by:
Hi, I'm currently working with the Treeview control in ASP .Net 2.0. The tree is filled dynamically based on data contained in a MySQL Database. Here is the exact behavior I want : 1 - User...
1
by: Nikron | last post by:
Hi, I'm having an issue with the ASP.NET 2.0 Treeview control and persisting its' state accross requests. My Control is embedded within a master page and is used for site navigation. My problem...
2
by: vincent90152900 | last post by:
Following is my code and I want the Panel1 display beside the TreeView1. I found out the ModalPopupExtender has two property, “X”, and “Y”. So, I wish I could find out the position of a...
2
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
0
by: Falcula | last post by:
Hello, I have a treeview that i fill from a database, when i update nodename in database the treeview dont update. Its works when iam not useing enableviewstate="true" but then i loosing the...
0
by: alps11 | last post by:
I have treeview with datasource from web.sitemap file, which provide url and title for each node (parent and child). I want to expand treeview when user clicks the parent node(since parent node has...
0
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I have a treeview, which is in an accordion, which is in an updatepanel. When I click on a node in the treeview, it loads up a control as it should. When I click on the same node again, the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.