views:

17

answers:

1

I am working with a few .Net 4.0 webforms controls such as the Menu control and while I think it's great that I can now declare the way in which controls are rendered (i.e. as either tables or divs), I can't switch off the automagically-included javascript that manages the hover events for those controls, for example:

new Sys.WebForms.Menu({ element: 'NavigationMenu', disappearAfter: 500, orientation: 'horizontal', tabIndex: 0, disabled: false }

This appears at the bottom of every page that owns such a control.

Given there is no way to actually switch this off, what is the best approach to either disabling this script, overriding it or in some other way rendering it impotent so that I can define my own jQuery methods in its place?

+1  A: 

Well, what you can try is include some javascript after the Webforms scripts are included that does the following:

Sys.WebForms.Menu = function() {};

Basically, that overrides the webforms Menu javascript to do nothing. Be careful though, especially if your working on an existing project that uses these menus already, as they're javascript will no longer work.

Personally, I would recommend creating your own menu markup, css and javascript using a much "leaner" control like the Repeater or ListView. This would avoid most of these issues and you would have much more control over the output.

Sean Amos
I'd considered that, but because I'm binding to a Sitemap data source, I want to avoid going to the trouble of recursing through the data to generate something that should be "out-of-the-box". That said, if I don't get the results I need with this, I may reconsider.
Phil.Wheeler