Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > TreeView SelectedNodeChanged Event

Reply
Thread Tools

TreeView SelectedNodeChanged Event

 
 
Andrew Robinson
Guest
Posts: n/a
 
      12-05-2005
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


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-06-2005
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" <(E-Mail Removed)>
| 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: <ugjvv7c#(E-Mail Removed)>
| 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
|
|
|

 
Reply With Quote
 
 
 
 
Andrew Robinson
Guest
Posts: n/a
 
      12-06-2005
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]" <(E-Mail Removed)> wrote in message
news:5tBtIkk%(E-Mail Removed)...
> 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" <(E-Mail Removed)>
> | 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: <ugjvv7c#(E-Mail Removed)>
> | 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
> |
> |
> |
>



 
Reply With Quote
 
Andrew Robinson
Guest
Posts: n/a
 
      12-06-2005
Ok, I answered my own question:

TreeView1.SelectedNode.Selected = false;

This is what I was looking for.

-Andrew

"Andrew Robinson" <(E-Mail Removed)> wrote in message
news:u5MmnJo%(E-Mail Removed)...
> 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]" <(E-Mail Removed)> wrote in message
> news:5tBtIkk%(E-Mail Removed)...
>> 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" <(E-Mail Removed)>
>> | 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: <ugjvv7c#(E-Mail Removed)>
>> | 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
>> |
>> |
>> |
>>

>
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-07-2005
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" <(E-Mail Removed)>
| References: <ugjvv7c#(E-Mail Removed)>
<5tBtIkk#(E-Mail Removed)>
<u5MmnJo#(E-Mail Removed)>
| 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: <uTYBigp#(E-Mail Removed)>
| 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" <(E-Mail Removed)> wrote in message
| news:u5MmnJo%(E-Mail Removed)...
| > 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]" <(E-Mail Removed)> wrote in message
| > news:5tBtIkk%(E-Mail Removed)...
| >> 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" <(E-Mail Removed)>
| >> | 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: <ugjvv7c#(E-Mail Removed)>
| >> | 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
| >> |
| >> |
| >> |
| >>
| >
| >
|
|
|

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeView SelectedNodeChanged Triggers Parent's TreeNodePopulate? dmeglio@gmail.com ASP .Net 1 08-04-2008 09:55 PM
TreeView SelectedNodeChanged event Velislav ASP .Net 0 11-24-2006 11:27 AM
SelectedNode is not correct in SelectedNodeChanged event stacy@sensorswitch.com ASP .Net 0 09-19-2006 07:43 PM
Masterpage Treeview SelectedNodeChanged and Style errors biker ASP .Net Web Controls 0 08-03-2006 04:33 PM
selectednodechanged event on .NET 2.0 treeview problem tanya foster ASP .Net 1 06-05-2006 12:38 PM



Advertisments