473,486 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 9365
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
2235
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
11656
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
4727
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
10010
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
1460
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
1197
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
4247
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
2173
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
4954
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
6964
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...
0
7123
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
7175
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...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7319
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...
0
5430
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
4559
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...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
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...

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.