By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,906 Members | 1,700 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,906 IT Pros & Developers. It's quick & easy.

TreeView SelectedNodeChanged Event

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.