I am designing a custom HTML helper and I would like to execute Html.ActionLink to provide dynamic URL generation.
我正在设计一个自定义的HTML助手,我想执行HTML。提供动态URL生成的ActionLink。
namespace MagieMVC.Helpers
{
public static class HtmlHelperExtension
{
public static string LinkTable(this HtmlHelper helper, List items)
{
string result = String.Empty;
foreach (Method m in items)
{
result += String.Format(
"" +
System.Web.Mvc.Html.ActionLink(...) +
" ",
m.Category.Name,m.ID, m.Name);
}
return result;
}
}
}
Unfortunately Html.ActionLink is not recognized in this context whatever the namespace I have tried to declare.
不幸的是Html。无论我试图声明的名称空间是什么,ActionLink都没有被识别。
As a generic question, I would like to know if it is possible to use any existing standard/custom Html helper method when designing a new custom helper.