これを使用して、ページにカスタムhtmlボタンを作成しようとしています。
public static class HtmlButtonExtension
{
public static MvcHtmlString Button(this HtmlHelper helper, string text,
IDictionary<string, object> htmlAttributes)
{
var builder = new TagBuilder("button");
builder.InnerHtml = text;
builder.MergeAttributes(htmlAttributes);
return MvcHtmlString.Create(builder.ToString());
}
}
このボタンをクリックすると、recordIDをアクションに渡します
以下に、かみそりのビューに追加したものを示します
@ Html.Button( "Delete"、new {name = "CustomButton"、recordID = "1"})
しかし、私はこのボタンを表示することができませんでした、そしてそれはエラーを投げています
'System.Web.Mvc.HtmlHelper<wmyWebRole.ViewModels.MyViewModel>' does not contain a definition for 'Button' and the best extension method overload 'JSONServiceRole.Utilities.HtmlButtonExtension.Button(System.Web.Mvc.HtmlHelper, string, System.Collections.Generic.IDictionary<string,object>)' has some invalid arguments
誰かが実際のエラーを特定するのを手伝ってくれますか