Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 2 Jul 2008 06:00:57 -0700 (PDT),    group: microsoft.public.dotnet.framework.aspnet.webcontrols        back       


MenuItemClick not firing if programmatically changing selected item on a Menu Control   
Hello, if you programmatically change the selected menu item (as
opossed to the user clicking on a menu item) on a ASP.NET 2.0 Menu
control as follows:

Menu Control:
<asp:Menu ID="mnuActions"....

Code to programmatically change the selected menu item:
    Dim mi As MenuItem = Me.mnuActions.FindItem("Customers")
    mi.Selected = True

The above code will not fire the MenuItemClick event. (This was
expected since the user did not click on the item)

My question is, is there another event that will detect when the
selected menu item was programmatically changed?

Thanks Before Hand,
Adiel
date: Wed, 2 Jul 2008 06:00:57 -0700 (PDT)   author:   unknown

Re: MenuItemClick not firing if programmatically changing selected item on a Menu Control   
Hi Adiel

> Code to programmatically change the selected menu item:
>    Dim mi As MenuItem = Me.mnuActions.FindItem("Customers")
>    mi.Selected = True
> 
> The above code will not fire the MenuItemClick event. (This was
> expected since the user did not click on the item)
This is the expected behavior.
Theres no user interaction, theres no event fireing.

Do fire your event manually or do your stuff right on that place you set
the item to "selected = true".

> My question is, is there another event that will detect when the
> selected menu item was programmatically changed?
no

-- 
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
date: Mon, 7 Jul 2008 10:34:20 +0200   author:   Peter Bucher [MVP]

Re: MenuItemClick not firing if programmatically changing selected item on a Menu Control   
On 2 Jul, 14:00, adie...@hotmail.com wrote:
> Hello, if you programmatically change the selected menu item (as
> opossed to the user clicking on a menu item) on a ASP.NET 2.0 Menu
> control as follows:
>
> Menu Control:
> <asp:Menu ID="mnuActions"....
>
> Code to programmatically change the selected menu item:
>     Dim mi As MenuItem = Me.mnuActions.FindItem("Customers")
>     mi.Selected = True
>
> The above code will not fire the MenuItemClick event. (This was
> expected since the user did not click on the item)
>
> My question is, is there another event that will detect when the
> selected menu item was programmatically changed?
>
> Thanks Before Hand,
> Adiel

Dear Adiel

Events are normally triggered by user activity on the client, by the
host system external to the application, autonomous  routines within
the application (example page loading) or other entities (e.g.
asynchronous communications) that are not under direct control of the
application itself.

That is the sole purpose of them. Anything that is done
programatically using code written by the developer is controlled and
handled by the code itself and at the time of its execution.

It makes no sense to require "detection" of programmatic changes in
event handlers.

HTH
date: Mon, 7 Jul 2008 10:35:19 -0700 (PDT)   author:   Stan

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us