473,421 Members | 1,744 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,421 software developers and data experts.

TreeView SelectedNodeChanged Event

I am using a TreeView to perform navigation and have a few nodes that need
to generate a popup menu. For this, I use the SelectedNodeChanged event and
then add the relevant "window.open" script to the page using the
ClientScript.RegisterStartupScript method.

This seems to work fine, but if the user clicks on the same node twice, the
event doesn't fire a second time. I assume this is by design as the Node
Selection hasn't changed, but anyone know of a way to clear the selection
without clearing all of the nodes on the TreeView and repopulating them?
Thanks,
Andrew
Dec 5 '05 #1
4 9358
Hi Andrew,

Welcome to ASPNET newsgroup.
Regarding on the TreeView Control's SelectedNodeChanged event, based on my
research, it is only working when a certain node is not selected. After it
is selected, we can not make it fire again if we haven't changed selected
node between the multiple selecting.... Also, seems the current TreeView
control dosn't support define custom ItemTemplate... And I'm not sure
whether the Menu Control can be an alternative approach for your scenario?
The ASP.NET 2.0 Menu control can let us define Menu Item template for
static and dynamic menu items, so that different kinds of controls can
appear when menu displayed. For example:

<asp:Menu ID="Menu1" runat="server" >
<StaticItemTemplate>
<asp:LinkButton ID="LinkButton3"
runat="server">LinkButton</asp:LinkButton>
</StaticItemTemplate>
<DynamicItemTemplate>
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
</DynamicItemTemplate>
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: "Andrew Robinson" <ne****@nospam.nospam>
| Subject: TreeView SelectedNodeChanged Event
| Date: Mon, 5 Dec 2005 11:06:01 -0800
| Lines: 17
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <ug**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 216.57.203.121
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362835
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I am using a TreeView to perform navigation and have a few nodes that
need
| to generate a popup menu. For this, I use the SelectedNodeChanged event
and
| then add the relevant "window.open" script to the page using the
| ClientScript.RegisterStartupScript method.
|
| This seems to work fine, but if the user clicks on the same node twice,
the
| event doesn't fire a second time. I assume this is by design as the Node
| Selection hasn't changed, but anyone know of a way to clear the selection
| without clearing all of the nodes on the TreeView and repopulating them?
|
|
| Thanks,
|
|
| Andrew
|
|
|

Dec 6 '05 #2
Steve,

Not sure why you talking about a template? what would that accomplish or
solve?

Is there any way of changing the selected node between postbacks?

Thanks,

-Andrew

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:5t***************@TK2MSFTNGXA02.phx.gbl...
Hi Andrew,

Welcome to ASPNET newsgroup.
Regarding on the TreeView Control's SelectedNodeChanged event, based on my
research, it is only working when a certain node is not selected. After it
is selected, we can not make it fire again if we haven't changed selected
node between the multiple selecting.... Also, seems the current TreeView
control dosn't support define custom ItemTemplate... And I'm not sure
whether the Menu Control can be an alternative approach for your scenario?
The ASP.NET 2.0 Menu control can let us define Menu Item template for
static and dynamic menu items, so that different kinds of controls can
appear when menu displayed. For example:

<asp:Menu ID="Menu1" runat="server" >
<StaticItemTemplate>
<asp:LinkButton ID="LinkButton3"
runat="server">LinkButton</asp:LinkButton>
</StaticItemTemplate>
<DynamicItemTemplate>
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
</DynamicItemTemplate>
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: "Andrew Robinson" <ne****@nospam.nospam>
| Subject: TreeView SelectedNodeChanged Event
| Date: Mon, 5 Dec 2005 11:06:01 -0800
| Lines: 17
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <ug**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 216.57.203.121
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362835
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I am using a TreeView to perform navigation and have a few nodes that
need
| to generate a popup menu. For this, I use the SelectedNodeChanged event
and
| then add the relevant "window.open" script to the page using the
| ClientScript.RegisterStartupScript method.
|
| This seems to work fine, but if the user clicks on the same node twice,
the
| event doesn't fire a second time. I assume this is by design as the Node
| Selection hasn't changed, but anyone know of a way to clear the
selection
| without clearing all of the nodes on the TreeView and repopulating them?
|
|
| Thanks,
|
|
| Andrew
|
|
|

Dec 6 '05 #3
Ok, I answered my own question:

TreeView1.SelectedNode.Selected = false;

This is what I was looking for.

-Andrew

"Andrew Robinson" <ne****@nospam.nospam> wrote in message
news:u5***************@tk2msftngp13.phx.gbl...
Steve,

Not sure why you talking about a template? what would that accomplish or
solve?

Is there any way of changing the selected node between postbacks?

Thanks,

-Andrew

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:5t***************@TK2MSFTNGXA02.phx.gbl...
Hi Andrew,

Welcome to ASPNET newsgroup.
Regarding on the TreeView Control's SelectedNodeChanged event, based on
my
research, it is only working when a certain node is not selected. After
it
is selected, we can not make it fire again if we haven't changed selected
node between the multiple selecting.... Also, seems the current
TreeView
control dosn't support define custom ItemTemplate... And I'm not sure
whether the Menu Control can be an alternative approach for your
scenario?
The ASP.NET 2.0 Menu control can let us define Menu Item template for
static and dynamic menu items, so that different kinds of controls can
appear when menu displayed. For example:

<asp:Menu ID="Menu1" runat="server" >
<StaticItemTemplate>
<asp:LinkButton ID="LinkButton3"
runat="server">LinkButton</asp:LinkButton>
</StaticItemTemplate>
<DynamicItemTemplate>
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
</DynamicItemTemplate>
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: "Andrew Robinson" <ne****@nospam.nospam>
| Subject: TreeView SelectedNodeChanged Event
| Date: Mon, 5 Dec 2005 11:06:01 -0800
| Lines: 17
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <ug**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 216.57.203.121
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362835
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I am using a TreeView to perform navigation and have a few nodes that
need
| to generate a popup menu. For this, I use the SelectedNodeChanged event
and
| then add the relevant "window.open" script to the page using the
| ClientScript.RegisterStartupScript method.
|
| This seems to work fine, but if the user clicks on the same node twice,
the
| event doesn't fire a second time. I assume this is by design as the
Node
| Selection hasn't changed, but anyone know of a way to clear the
selection
| without clearing all of the nodes on the TreeView and repopulating
them?
|
|
| Thanks,
|
|
| Andrew
|
|
|


Dec 6 '05 #4
Thanks for your response Andrew,

I mentioned template in Menu since that can help us define some html
template (such as <div> ) and registering clientscript for dynamically
show/ hide layer ..... at clientside.. And TreeView is limited on such
functionality. Anyway, glad that you've found the things you looking for...
Regards,

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: "Andrew Robinson" <ne****@nospam.nospam>
| References: <ug**************@TK2MSFTNGP12.phx.gbl>
<5t*************@TK2MSFTNGXA02.phx.gbl>
<u5*************@tk2msftngp13.phx.gbl>
| Subject: Re: TreeView SelectedNodeChanged Event
| Date: Tue, 6 Dec 2005 11:06:14 -0800
| Lines: 113
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Response
| Message-ID: <uT**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 216.57.203.121
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:363163
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Ok, I answered my own question:
|
| TreeView1.SelectedNode.Selected = false;
|
| This is what I was looking for.
|
| -Andrew
|
| "Andrew Robinson" <ne****@nospam.nospam> wrote in message
| news:u5***************@tk2msftngp13.phx.gbl...
| > Steve,
| >
| > Not sure why you talking about a template? what would that accomplish
or
| > solve?
| >
| > Is there any way of changing the selected node between postbacks?
| >
| > Thanks,
| >
| > -Andrew
| >
| > "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| > news:5t***************@TK2MSFTNGXA02.phx.gbl...
| >> Hi Andrew,
| >>
| >> Welcome to ASPNET newsgroup.
| >> Regarding on the TreeView Control's SelectedNodeChanged event, based
on
| >> my
| >> research, it is only working when a certain node is not selected.
After
| >> it
| >> is selected, we can not make it fire again if we haven't changed
selected
| >> node between the multiple selecting.... Also, seems the current
| >> TreeView
| >> control dosn't support define custom ItemTemplate... And I'm not sure
| >> whether the Menu Control can be an alternative approach for your
| >> scenario?
| >> The ASP.NET 2.0 Menu control can let us define Menu Item template for
| >> static and dynamic menu items, so that different kinds of controls can
| >> appear when menu displayed. For example:
| >>
| >> <asp:Menu ID="Menu1" runat="server" >
| >> <StaticItemTemplate>
| >> <asp:LinkButton ID="LinkButton3"
| >> runat="server">LinkButton</asp:LinkButton>
| >> </StaticItemTemplate>
| >> <DynamicItemTemplate>
| >> <asp:Calendar ID="Calendar1"
runat="server"></asp:Calendar>
| >> </DynamicItemTemplate>
| >>
| >>
| >> 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: "Andrew Robinson" <ne****@nospam.nospam>
| >> | Subject: TreeView SelectedNodeChanged Event
| >> | Date: Mon, 5 Dec 2005 11:06:01 -0800
| >> | Lines: 17
| >> | X-Priority: 3
| >> | X-MSMail-Priority: Normal
| >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| >> | X-RFC2646: Format=Flowed; Original
| >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| >> | Message-ID: <ug**************@TK2MSFTNGP12.phx.gbl>
| >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| >> | NNTP-Posting-Host: 216.57.203.121
| >> | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| >> | Xref: TK2MSFTNGXA02.phx.gbl
| >> microsoft.public.dotnet.framework.aspnet:362835
| >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| >> |
| >> | I am using a TreeView to perform navigation and have a few nodes that
| >> need
| >> | to generate a popup menu. For this, I use the SelectedNodeChanged
event
| >> and
| >> | then add the relevant "window.open" script to the page using the
| >> | ClientScript.RegisterStartupScript method.
| >> |
| >> | This seems to work fine, but if the user clicks on the same node
twice,
| >> the
| >> | event doesn't fire a second time. I assume this is by design as the
| >> Node
| >> | Selection hasn't changed, but anyone know of a way to clear the
| >> selection
| >> | without clearing all of the nodes on the TreeView and repopulating
| >> them?
| >> |
| >> |
| >> | Thanks,
| >> |
| >> |
| >> | Andrew
| >> |
| >> |
| >> |
| >>
| >
| >
|
|
|

Dec 7 '05 #5

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

Similar topics

3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
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....
1
by: tanya foster | last post by:
Hello, I have populated a treeview in asp.net 2.0 from an xmldocument. The treeview structure in the asp web page looks something like... -orderdata -order -lines -operations -materials...
4
by: tfsmag | last post by:
Okay, I have a project management app i'm writing and in the left hand menu i have a treeview control that is populated with each project... in child nodes under each project node I have an "edit"...
0
by: Velislav | last post by:
Hi Quick question: Theoretically, is the SelectedNodeChanged event fired when the currently selected node is actually changed (as the name implies) or when any node is selected, including the...
5
by: Josh | last post by:
Hi, I'm trying to use the standard TreeView in VS2005 ( under the navigation menu ). But I cant get any events to postback and none of the style settings are being applied. None of the...
2
by: Ed Dror | last post by:
Hi there, Based on Microsoft ASP.NET SDK treeview control binding to northwind database (Categoried, Products) I added the following code Protected Sub TreeView1_SelectedNodeChanged(ByVal...
2
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
My first time using a TreeView: I've got a TreeView that I populated with some data and it has nodes. In the Properties window, I created an Event Handler for the TreeView's AfterSelect...
1
by: dmeglio | last post by:
I have a treeview control. The "root" elements and the 2nd level elements are set to PopulateOnDemand. All is fine, my TreeNodePopulate triggers and works. When you click one of those nodes, I load...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
0
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...

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.