这很奇怪.我看到了@Html的引用.Button()但当我输入Intellisense时,却找不到这样的助手...有下拉列表、隐藏、编辑等等,但没有按钮!
那是怎么回事?
这很奇怪.我看到了@Html的引用.Button()但当我输入Intellisense时,却找不到这样的助手...有下拉列表、隐藏、编辑等等,但没有按钮!
那是怎么回事?
public static class HtmlButtonExtension
{
public static MvcHtmlString Button(this HtmlHelper helper,
string innerHtml,
object htmlAttributes)
{
return Button(helper, innerHtml,
HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)
);
}
public static MvcHtmlString Button(this HtmlHelper helper,
string innerHtml,
IDictionary<string, object> htmlAttributes)
{
var builder = new TagBuilder("button");
builder.InnerHtml = innerHtml;
builder.MergeAttributes(htmlAttributes);
return MvcHtmlString.Create(builder.ToString());
}
}