Reputation: 305
I am trying to extract out duplicated code into an Html.Helpers class. I am able to use the helper class with simple html, but when I try to use the Kendo UI extensions I get and error. saying that:
CS1928: 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'Kendo' and the best extension method overload 'Kendo.Mvc.UI.HtmlHelperExtension.Kendo(System.Web.Mvc.HtmlHelper)' has some invalid arguments
Any help or workaround to get this to work is appreciated. I want to keep the file in the app_code folder if possible due to standards compliance.
@using Kendo.Mvc.UI
@helper LEASearch(string name)
{
@(Html.Kendo().AutoComplete()
.Name(name)
.Filter("contains")
.Placeholder("Entity ID, CTDS or Name")
.MinLength(2)
.HtmlAttributes(new { style = "width:390px" })
.DataSource(source => source.Read(read => read.Action("SearchLEAList", "DataPush")
.Data("onLEASearchIncluded"))
.ServerFiltering(true)).Events(events=> events.Select("selectLEAIncluded"))
.Template("<h5 data_entity=\"${data.EntityID}\""+
" data_ctds=\"${data.CTDS}\" data_name=\"${data.Name}\">"+
"ID:${data.EntityID} CTDS:${data.CTDS}</h5>"+
"<p>${data.Name}</p>")
);
}
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="Kendo.Mvc.UI"/>
</namespaces>
</pages>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
Upvotes: 2
Views: 1873
Reputation: 30661
It looks as if accessing HtmlHelper extension methods isn't supported. Here is what i found in the ASP.NET forums: http://forums.asp.net/t/1799665.aspx
Upvotes: 2