S
Shapper
Hello,
I have an extension as follows:
public static HtmlString Menu(this HtmlHelper html) { }
But I would like being able to use it as follows:
@(Html.Menu().Name("menu")
.Items(menu =>
menu.Add().Text("Home").Action("Index", "Home");
menu.Add().Text("Company").Items(item => {
item.Add().Text("About Us").Action("AboutUs", "Company");
item.Add().Text("Contact").Action("Contact", "Company");
});
}))
Then I need to build a string with the value in Name and with Items and Sub-Items and their Text and Action properties.
I am not sure how can this be done.
I just know that it is possible because I saw a company that does this but it is not open source so I am not able to look at it.
Any idea of how can I do this?
I have an extension as follows:
public static HtmlString Menu(this HtmlHelper html) { }
But I would like being able to use it as follows:
@(Html.Menu().Name("menu")
.Items(menu =>
menu.Add().Text("Home").Action("Index", "Home");
menu.Add().Text("Company").Items(item => {
item.Add().Text("About Us").Action("AboutUs", "Company");
item.Add().Text("Contact").Action("Contact", "Company");
});
}))
Then I need to build a string with the value in Name and with Items and Sub-Items and their Text and Action properties.
I am not sure how can this be done.
I just know that it is possible because I saw a company that does this but it is not open source so I am not able to look at it.
Any idea of how can I do this?