How would I access a Parent Container to change its css in an Html Helper Method?
I know how to return Html but I don't know if its possible to access the Parent Container when Html Helpers are in fact supposed to render Html, not change existing markup.
If not how could I add HtmlStrings together like:
var htmlstring = htmlHelper.ActionLink(linkText, actionName, controllerName);
return new HtmlString("<li>") + htmlstring + new HtmlString("</li>");
Any suggestions? Thanks.
To add Html Strings together or rather the ActionLink and text use this:
new HtmlString("<li>" +
htmlHelper.ActionLink(linkText, actionName, controllerName)
+ "</li>");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.