CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > microsoft_downloads.css_friendly_control_adapters Tags:
Item Type: NewsGroup Date Entered: 10/25/2006 10:04:13 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 7 Views: 204 Favorited: 0 Favorite
8 Items, 1 Pages 1 |< << Go >> >|
Rasetti
Asp.Net User
Beta 3: Menu not firing MenuItemClick Event10/25/2006 10:04:13 PM

0

Hi Russ!! Congratulations for the new beta!

I had this code with the previous beta which worked ok:

There is a page with this menu control:

<asp:Menu runat="server" ID="Menu2" DisappearAfter="500" Orientation="Horizontal" CssSelectorClass="DashboardMenu2" StaticDisplayLevels="1" MaximumDynamicDisplayLevels="5" OnMenuItemClick="ChangeSelection">
  
<Items>
      
<asp:MenuItem Selectable="false" Text="Select Geography" />
   
</Items>
</asp:Menu>

 Then, in the code behind file, I programatically add items to the menu, ending up with a five level menu. I can post the code if needed.

What happens now is that the page postbacks when I select a menu item but the MenuItemClick event is not beign fired (regardless if I explicetly set the OnMenuItemClick function like in the code above, or if I just use the MenuItemClick handler)

Any ideas? Just let me know if you need more code details.

Thanks,

Juan


Juan Barrera
MCTS


Please remember to click "Mark as Answer" on this post if it helped you.
Russ Helfand
Asp.Net User
Re: Beta 3: Menu not firing MenuItemClick Event10/26/2006 1:11:38 AM

0

Hi Juan,

I'm sorry you ran into a problem with the new release.  Let's explore what might be going wrong.

Try out this page, http://www.asp.net/CSSAdapters/WalkThru/SimpleMenu.aspx.

When you click on a menu item on that page it fires the MenuItemClick handler on the server.  Take a look at the markup/code, http://www.asp.net/CSSAdapters/SrcViewer.aspx?inspect=~/WalkThru/SimpleMenu.aspx&notree=true.

Does that sample page work for you, too?  If so, I wonder if you can compare what you are doing with this sample.  Where are they different?


Russ Helfand
Groovybits.com
Rasetti
Asp.Net User
Re: Beta 3: Menu not firing MenuItemClick Event10/26/2006 1:37:24 AM

0

Hi Russ,

Yes, the sample is working here.

So, I started to compare it with mine: The only difference I found is that I'm also setting the value property for each menu item.  

Here is the "ChangeSelection" code i'm calling on the "OnMenuItemClick" handler:

Protected Sub ChangeSelection(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs)
  e.Item.Selected =
True
 
SummaryDataBind()
End Sub

And that's the problem: it's not firing that event. 

As  said before, I tried first to do it with a handler event (Protected Sub Menu2_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu2.MenuItemClick) with no luck.


Juan Barrera
MCTS


Please remember to click "Mark as Answer" on this post if it helped you.
Russ Helfand
Asp.Net User
Re: Beta 3: Menu not firing MenuItemClick Event10/26/2006 3:56:31 PM

0

Have you tried (temporarily) not setting the value on your menu items to see if, suddenly, the click event gets properly fired?  That would be helpful to know.  I must admit that I'm betting that you still find that the event doesn't fire.  In that case, I would recommend that you make a copy of the sample page that does work (the one that I pointed out to you) and modify it step-by-step to have the logic that you want.  At some point it will either stop calling the click event (and you'll know what change you made latest that is responsible for the problem) or it will work and you can ditch your old page which somehow isn't working.  Just a thought...
Russ Helfand
Groovybits.com
Rasetti
Asp.Net User
Re: Beta 3: Menu not firing MenuItemClick Event10/26/2006 8:37:56 PM

0

Ok Russ, it sounded like a good idea to me, so I did it :)

I tried all the following:
1) If I disable the Menu adapter extensions (commenting out the "Menu" adapter line in CSSFriendlyAdapters.browser), everything works fine.
2) I tried removing all the ajax bits in the page, so no ajax is messing up with the controls, with no luck.
3) It doesn't matter if you add the controls programatically or if you declare them in the .aspx page, it doesn't work either way.

Finally, I went to the "values" problem, and I found the "solution": I was setting the value for the first dynamic level item as an empty string ( "" ), and it seems that it needs some value, any, but not an empty string. So it was causing ALL the child controls not to fire the MenuItemClick event.

The thing is that, without the adapters, it works, and I think it "should" work, even with an empty value. Now. as a workaround, i'm using a dummy non-empty value, but I guess it should be fixed.

Cheers,

Juan

 

 

 

 

 

 


Juan Barrera
MCTS


Please remember to click "Mark as Answer" on this post if it helped you.
Russ Helfand
Asp.Net User
Re: Beta 3: Menu not firing MenuItemClick Event10/26/2006 9:37:34 PM

0

Nice detective work, Juan. Let me dig into this now that you narrowed it down.  I'll let you know what I find.  Hopefully, we'll get it fixed for the next rev of the kit. For now, it sounds like your workaround is adequate, albeit non-optimal.
Russ Helfand
Groovybits.com
Rasetti
Asp.Net User
Re: Beta 3: Menu not firing MenuItemClick Event10/26/2006 9:44:47 PM

0

Ok, Russ, just but the sake of curiosity let us know what you find! :)

Anyway, it's a minor thing, could be easily "workarounded" for now :)


Juan Barrera
MCTS


Please remember to click "Mark as Answer" on this post if it helped you.
Russ Helfand
Asp.Net User
Re: Beta 3: Menu not firing MenuItemClick Event10/27/2006 11:35:08 PM

0

Hi Juan,

I've been doing more research into this issue.  I've discovered some things that I want to share with you.

I'm going to suggest that you re-validate your assertion that this problem only occurs when you use the adapters.  My testing is showing that it occurs in both the adapted and unadapted cases.

That actually makes sense to me, given the heuristics involved.  Let me explain.

When a menu is built to post back to itself its links use the usual __doPostDack JavaScript method.  This is done the exact same way (or that's the intention) both with and with the adapters in play.  If you hover over a menu link you can see its URL in the status bar of the browser.  Look at the second argument of __doPostBack.  It identifies the particular menu item that will be clicked.  It's how the framework on the server knows how to formulate the right event args to pass to the click handler.

That second arg to __doPostBack is actually the ValuePath of the MenuItem.  Each menu item, under the hood, can have a value.  If these values are unique then they give the menu a way to uniquely identify all of its menu items.  Actually, you can get away with giving the same value to two menu items but they can't be siblings.  That would be like naming two children (of the same mother and father) Bob and then expecting that folks would understand when you referred to "Bob's left hand."  Hmmm.  Which Bob are you talking about?

So the basic problem in your original scenario is what you ultimately found: you had defined Value properties such that the menu didn't have a way to give each menu item a unique ValuePath, thus it could not identify the menu items properly.  So the post back event handling got messed up and didn't happen as you expected.

The fix is exactly as you discovered, make sure that your menu item Value properties (if you specify them) are unique (at least for all sibling menu items).

I tested this whole using a modified version of walkthru\simplemenu.aspx from the kit.  I enabled and disabled the adapters by retaining or deleting (temporarily) the browser file in App_Browsers.  In my tests I placed Value="x" on sibling menu items in the menu in simplemenu.aspx.  Then I ran the page in a browser (being sure to refresh the page or dump my page cache ahead of time).  Then I clicked each menu item.  Whenever sibling menu items had the same value I ran into problems with at least some of the menu items not triggering the OnClick handler for the menu click event.  I could dup this problem regardless of the value I gave to Value.  I could even give it the empty string "" and the problem would occur.

As I said, I seemed to be able to dup this problem both with and without adapters in play.

Be sure to test lots of the menu items, not just the ones where you add the Value attribute.  The pattern of which ones work and which don't is a little tricky to see.

Also, be very, very careful to refresh your page after you modify it to be sure you aren't actually running the PREVIOUS incarnation of the page.

The bottom line to all this is that I don't see a simple way to avoid this problem in the kit.  I'm inclined to leave the adapter code as-is.  Are you OK with that?  It simply means that you need to be careful not to make ValuePath ambigous for you menu items.  And this seems to be a restriction in the unadapted case, too.


Russ Helfand
Groovybits.com
8 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Beta 3: Menu not firing MenuItemClick Event - ASP.NET Forums What happens now is that the page postbacks when I select a menu item but the MenuItemClick event is not beign fired (regardless if I ...
Beta 3: Menu not firing MenuItemClick Event - ASP.NET Forums Re: Beta 3: Menu not firing MenuItemClick Event. 10-25-2006, 9:11 PM. Contact ... Re: Beta 3: Menu not firing MenuItemClick Event. 10-25-2006, 9:37 PM ...
MenuItemClick event does not fire in ASP.NET The problem i have is i need to pass the Menu Item that has been clicked from the Menu page to this Search Page and the Menuitem click event does not fire. ...
MenuItem Click event not firing from Context Menu : firing, event 3. Idle_Mind 217240. 4. Dhaest 125100. 5. emoreau 104280. 6. Fernando... 97372. 7. TheLearn... 97365 ... MenuItem Click event not firing from Context Menu .... Announcements; Beta Feedback; CleanUp. EE Bugs; Feedback; General ...
Matthew Cosier's Blog: ASP.NET 2.0 Menu – MenuItemClick not ... NET 2.0 Menu – MenuItemClick not posting back/firing event. This entry has been moved, Please Click Here to View ... February (3). Office SharePoint Server 2007 Reporting Services I.. ... Office Beta 2 Technical Refresh is HERE! ...
Embarcadero Discussion Forums: MS Office eventhandling ... 3) Use the ConnectTo method on the wrapper to connect it to the ... This works just fine, but I have no clue of how to setup event handlers for the menu item's click events. ... Of course this event will only fire after you've connected ... certain that this type library is not part of the office components ...
treeview AfterSelect Method and context menu .net cf 2.0 These allow the user to fire off code from a hold tap or from a tap release. ... Make sure you DO NOT create/drag a context menu onto the form because the ... 3. Create a sub called contextHander and pass the name of the treeview control as ... 'handling popup menu item click event, whatever is clicked, go to case ...
.NET ASP [Archive] - Page 48 - bytes Why no answer to the pb of catching a menuitemclik in a menu of a master ... Access 2007 beta & VS web developer incompatable? .... NET 2.0 · ViewState/ StateBag? menuitemclick event trouble from a master ... Server tag error w/ custom control on webf · asp.net dynamically created button not firing onClick event ...
Nabble - ydn-javascript - YUI 2.7.0 has been released Took selector, element, and profilerviewer out of beta. - json is an optional dependency for .... slide end event does not fire after move-via-click ...
Matthew Cosier's Blog: December 2006 NET 2.0 Menu – MenuItemClick not posting back/firing event. This entry has been moved, Please Click Here to View ... Posted by Matthew Cosier at 3:16 PM 0 comments Links to this post ... Office Beta 2 Technical Refresh is HERE! ...






nt authority\anonymous logon

errors in the web.config?

gridview data based on user login

can not get user.identity.name

security module! lost at start point!

activedirectorymembershipprovider

loginview control - design time problems

number of users

server- and development environment

caching and the membership user

changepassword control and membership provider

possible to use different types of authentication for different parts of a web application?

wshshell

how to point providers to a remote server

conditional login????

how to: implement this type of security scenario

can't reference textbox in login control

how do i: create a full-featured customer login portal

unc files not visible

data validation

redirect on loggedin event

access the client's local files from asp.net

filestream security

passport (version 4.0) integration issues

membership with my own database

asp.net 2.0 login control works on dev machine but not on live iis server

single login for multiple websites.

how can i deal with this error message? (urgent)

error hwile using "md5" or "sha1" algorithms

accessing remote files

   
  Privacy | Contact Us
All Times Are GMT