I have this very short custom helper
using System.Web.Mvc;
namespace Colibri.HtmlHelpers
{
public static class CustomHelper
{
public static MvcHtmlString SearchBar(this HtmlHelper helper, string type)
{
return new MvcHtmlString("<input type=\"text\" placeholder =\"Recherche...\" id=\"" + type + "-Search\" class=\"Search-Input\"/>");
}
}
}
In the Razor Web.config I added the namespace in the proper section:
<add namespace="Colibri.HtmlHelpers" />
An I just want to call it from a view with this code:
@Html.SearchBar("Article")
Here I get this error:
Error CS0121 The call is ambiguous between the following methods or properties: 'Colibri.HtmlHelpers.CustomHelper.SearchBar(System.Web.Mvc.HtmlHelper, string)' and 'Colibri.HtmlHelpers.CustomHelper.SearchBar(System.Web.Mvc.HtmlHelper, string)'
If I don't add the namespace in Web.config, it says:
Error CS1061 'HtmlHelper' does not contain a definition for 'SearchBar' and no extension method 'SearchBar' accepting a first argument of type 'HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
Thanks for your help.
SearchBar
method in whole project and check. – Rahul Nikate