I'm creating a menu control where I need to specify the Html element and inside this Html use Html.ActionLink(...
The markup I want to create should look like this, <li><a href="/some-link"></a>Some name</li>
My menu control has the following signature today (this Htmlhelper html, Func<IPage, MvcHtmlString> content) and I'm using this menu control like this @Html.Menu(page => Html.ActionLink(page) where Html.ActionLink(IPage) is my own extension method.
So how should the signature look if I would like to write something like this to create my menu item: @Html.Menu(page => @<li> @Html.ActionLink(page) </li>)?
I think I had some kinda brain freeze or something, but here is the solution I chose
public static MvcHtmlString Menu(this HtmlHelper html, Func<IPage, Func<object, HelperResult>> itemContent) {}
I this is how I use it in my project
@Html.Menu(page => @<li>@Html.ActionLink(page)</li>)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With