0
我想構建一個自定義HTML幫助程序。以下幾個教程,我的代碼 -自定義MVC3幫助程序的語法錯誤
namespace System.Web.Mvc.Html
{
using System;
using System.Web.Mvc;
public static class HtmlHelpers
{
public static string BuildJsonPrototype(this HtmlHelper helper, string targetName)
{
var d = BuildJsonModel.Build(typeof(Int32), targetName);
return d;
}
}
}
在我的Razor視圖,代碼 -
@using System.Web.Mvc.Html
@Html.BuildJsonModel("test")
當我嘗試運行它,我得到以下編譯器錯誤 -
Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<AutoBind.Models.ComplexModel>'
does not contain a definition for 'BuildJsonModel' and no extension method
'BuildJsonModel' accepting a first argument of type
'System.Web.Mvc.HtmlHelper <AutoBind.Models.ComplexModel>' could be found
(are you missing a using directive or an assembly reference?)
任何關於我的語法錯誤是什麼的建議?
它總是很明顯的東西,你看不到。謝謝。 –
沒問題 - 我們都曾經在那裏太多次:) – glosrob