473,804 Members | 3,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView: OnSelectedNodeC hanged not firing??

With this TreeView declaration:

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

SelectedNodeSty le-Font-Bold="true" SelectedNodeSty le-ForeColor="#003 E21"

OnTreeNodePopul ate="PopulateNo de" OnSelectedNodeC hanged="SelectN ode"

ExpandDepth="0" >

</asp:TreeView>

Nodes are added in PopulateNode() like so:

protected void PopulateNode(Ob ject source, TreeNodeEventAr gs e)

{

TreeNode newNode = null;

switch (e.Node.Depth)

{

case 0:

string locationIdStr = e.Node.Value;

try

{

int locationId = Convert.ToInt32 (locationIdStr) ;

e2006TableAdapt ers.MenusTableA dapter mta = new e2006TableAdapt ers.MenusTableA dapter();

mta.FillByLocat ionId(myDto.Men us, locationId);

foreach (e2006Table.Men usRow menuRow in myDto.Menus)

{

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

newNode.SelectA ction = TreeNodeSelectA ction.Expand;

newNode.Populat eOnDemand = true;

e.Node.ChildNod es.Add(newNode) ;

}

}

catch { }

break;

// etc

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

foreach (e2006.MenuItem sRow menuItems in myDto.MenuItems )

{

newNode = new TreeNode(menuIt ems.Name, menuItems.MenuI temId.ToString( ));

newNode.SelectA ction = TreeNodeSelectA ction.Select;

newNode.Navigat eUrl = "";

e.Node.ChildNod es.Add(newNode) ;

}

The question is: WHY doesn't the OnSelectedNodeC hanged="SelectN ode"

protected void SelectNode(Obje ct source, EventArgs e)

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

TIA,

geo

Dec 16 '05 #1
5 9503
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.mic rosoft.com> wrote in message
news:kV******** ********@TK2MSF TNGXA02.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.Select Action you set in the original code...

In order to make the "TreeNodePopula ted" and "SelectedNodeCh anged" event
get fired for your new created nodes, we should set their SelectAction to
"SelectExpa nd", e.g:

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

protected void TreeView1_TreeN odePopulate(obj ect sender, TreeNodeEventAr gs
e)
{
string name = e.Node.Text;
TreeNode node = null;
if (e.Node.ChildNo des == null || e.Node.ChildNod es.Count == 0)
{
for (int i = 0; i < 5; i++)
{
node = new TreeNode(name + i, name + i);
node.SelectActi on = TreeNodeSelectA ction.SelectExp and;
node.PopulateOn Demand = true;

e.Node.ChildNod es.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**********@n ewsgroup.nospam >
| References: <eg************ **@TK2MSFTNGP11 .phx.gbl>
<kV************ **@TK2MSFTNGXA0 2.phx.gbl>
| Subject: Re: TreeView: OnSelectedNodeC hanged 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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: c-24-128-25-74.hsd1.ma.comc ast.net 24.128.25.74
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3662 35
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Kevin, Is this issue still open?
|
| Thanks
| geo
|
| "Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
| news:kV******** ********@TK2MSF TNGXA02.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

onselectednodec hanged. 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" OnTreeNodePopul ate="TreeNodePo pulate"

OnSelectedNodeC hanged="TreeNod eSelectedNodeCh anged" ExpandDepth="0"
EnableViewState ="false"

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

Sub TreeNodeSelecte dNodeChanged(By Val sender As Object, ByVal e
As EventArgs)
Value = TreeView1.Selec tedNode.Value
Text = TreeView1.Selec tedNode.Text
TreeView1.Visib le = False
End Sub
Sub TreeNodePopulat e(ByVal sender As Object, ByVal e As
TreeNodeEventAr gs)
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("descriptio n").ToString ()
newNode.Value = row("code").ToS tring()
'If Not IsNumeric(newNo de.Value) Then
newNode.SelectA ction = TreeNodeSelectA ction.SelectExp and
newNode.Populat eOnDemand = True
'End If
e.Node.ChildNod es.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

onselectednodec hanged. 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" OnTreeNodePopul ate="TreeNodePo pulate"

OnSelectedNodeC hanged="TreeNod eSelectedNodeCh anged" ExpandDepth="0"
EnableViewState ="false"

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

Sub TreeNodeSelecte dNodeChanged(By Val sender As Object, ByVal e
As EventArgs)
Value = TreeView1.Selec tedNode.Value
Text = TreeView1.Selec tedNode.Text
TreeView1.Visib le = False
End Sub
Sub TreeNodePopulat e(ByVal sender As Object, ByVal e As
TreeNodeEventAr gs)
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("descriptio n").ToString ()
newNode.Value = row("code").ToS tring()
'If Not IsNumeric(newNo de.Value) Then
newNode.SelectA ction = TreeNodeSelectA ction.SelectExp and
newNode.Populat eOnDemand = True
'End If
e.Node.ChildNod es.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
11685
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. Navigating works with no postback and the style follow the selected node. When a new child is added to a node there is a button to refresh the node. This is done by a postback. After this postback the selected node stays keeps the selected style.
4
15936
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
2298
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 clicks on a node to expand it. 2 - Add a child node to the node clicked by the user saying the tree is loading that part. So here, I also need to expand the node clicked by
1
3605
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 is that the user wants to know which page they are currently on and therefore I need to highlight the selected node. The problem is I lose state whenever the user selects a node and is redirected to another page. Thanks in advance
2
1665
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 TreeView1 in a web page and then I can set the “X” and “Y” of the ModalPopupExtender. Does anyone know how to do that? Or any suggestion is welcome. <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> ...
2
5514
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 programmatically. And I want to bind the selection of a TreeNode (which is a record) from the database) to a DetailsView which shows the datatable record for the selected TreeView node in the Details View. I am using IDE : Visual Web Developer 2005 Express; OS=...
0
1904
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 current selection and stuff in the tree. I post my code here, any idea ?
0
1741
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 url , OnSelectedNodeChanged does not get fired ) How to expand treeview node which has url.
0
1721
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 previously loaded control disappears and does not get reloaded. I am not sure how this is happening. Can someone tell me why this is happening and show me how to stop the control from being unloaded. HTML and event for the treeview: <asp:UpdatePanel...
0
9569
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9130
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2975
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.