誰かが私を助けてくれることを願っています。MVC アプリケーション用のカスタム html ヘルパーを作成しようとしています。まず第一に、私はテスト用のものを試してみました。
指定されたパラメーターのタグ。名前空間を明示的にインポートしない限り、機能しません。私はたくさん読んできましたが、読んでいるように、そのメソッドは次のようにインポート名前空間なしで表示されるはずです:
<%=Html.Prueba("This is a paragraph") %>
しかし、このメソッド、Prueba は VS Intellisense には表示されません。
私のクラスは次のとおりです。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace EasyGoCostaRica.Helpers
{
public static class ViewsHelpers
{
//This method is just for testing. Is not working :(
public static string Prueba(this HtmlHelper helper, string param1)
{
return string.Format("<p>{0}</p>", param1);
}
}
}
前もって感謝します!