[英]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.
这就是为什么我的问题是关于我想以自己的方式扩展和呈现控件的控件。我正在使用SharePoint,但是SharePoint aspnet控件是密封的,所以我不能从中派生。
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. 我有一个菜单控件,该控件派生自:System.Web.UI.WebControls.Menu或Microsoft.SharePoint.WebControls.AspMenu我看不出有什么大不同。 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?
它们存在于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. 进行一次小小的更新就可以得到完整的图片:之所以这样做,是因为我需要将第一个控件而不是链接和文本呈现,而是将图像设置为提供的URL的图像链接。
Hello you can use extension method on Menu 您好,您可以在菜单上使用扩展方法
public static void YourExtension(this Menu control)
{
control.YourPropertyTarget = ....;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.