views:

35

answers:

2

I'm rewriting a web application to ASP.Net 4.0 and have included a Menu control (bound to a SiteMap file, naturally). While I'm liking the new RenderingMode property, I'm hating the fact that it automagically includes some javascript at the bottom of your page to animate the menu.

My preference would be for greater control using jQuery, but switching that off is proving very difficult. With some help from a very heavy hitter, I've been walked through to the point where I've discovered that the ASP.Net 4.0 Menu control has an internal OnPreRender method:

internal void OnPreRender(EventArgs e, bool registerScript);

How do I override this method so that I can call:

base.OnPreRender(e, false);

When trying at the moment, I'm getting an error from Visual Studio saying that "No overload for method 'OnPreRender' takes 2 arguments".

+1  A: 

You should be able to refer to protected internal methods as they are protected or internal. If the method is just internal you might be out of luck.

Looking at ASP.NET 4 Menu control, it only has one OnPreRender override:

protected internal override void OnPreRender(EventArgs e);

So you should be able to override it. Not sure where OnPreRender(EventArgs e, bool registerScript) comes from (perhaps it's internal), but the fact that the base class doesn't it(or it's inaccessible) is your problem.

Igor Zevaka
It is just internal. Guess that's the end of the road.
Phil.Wheeler
I suppose the alternative is to not call the base `PreRender` but write your own version in the override. Perhaps something like Reflector might help you figure out what exactly `OnPreRender(EventArgs e, bool registerScript)` does.
Igor Zevaka
A: 

Not a direct answer, but its pretty trivial to dump the contents of any IHeirarchicalDataSource, such as a sitemap file, to a <ul> which any number of jquery menu products can chew and make purdy.

Wyatt Barnett