Alnedru
Alnedru

Reputation: 2655

What is the correct way of overriding render method in Menu control

I did perform investigation and I didn't find good and constructive information to my questions. That is why my question is regarding the control which I would like to extend and render the controls on my own way.I'm working with SharePoint but the SharePoint aspnet control is sealed so I cannot derive from it.

What I have is a menu control which derives from: System.Web.UI.WebControls.Menu or Microsoft.SharePoint.WebControls.AspMenu I don't see any big difference. And I have the data source / data provider.

SiteMapDataSource dataSource = this.GetDataSource() as SiteMapDataSource;
SiteMapProvider provider = dataSource.Provider;

So I have all the needed elements.

Now the base classe has a lot of different methods which I can override, but I'm not sure how to start with.

Where and how should I create controls to render? Where do I render those controls? The contols they exist of html?

<ul>
 <li> </li>
 ...
</ul>

How do I build then a menu based on the provider?

Just a small update to give a full picture: I do this because I need to render first control not as a link and text but as a image link with image set to a provided url.

Upvotes: 0

Views: 494

Answers (1)

Aghilas Yakoub
Aghilas Yakoub

Reputation: 28990

Hello you can use extension method on Menu

public static void YourExtension(this Menu control)
{
     control.YourPropertyTarget = ....;
}

Upvotes: 1

Related Questions