1
votes

I am currently working with KendoUI using ASP.Net MVC Razor syntax.

I have drop downlists and editor widgets that are working well.

Problem came up when I needed to bind an event to a JS function.

I followed the docs found here: http://demos.telerik.com/kendo-ui/web/dropdownlist/events.html

In my partial view:

 @(Html.Kendo().DropDownListFor(model => model.ClientType)
                              .DataSource(ds => ds.Read(read => read.Action("FetchAllClientTypes", "ClientType")))
                              .DataTextField("Description")
                              .DataValueField("Id")
                              .AutoBind(true)
                              .ToClientTemplate()
                              .Events(e => e.Change("Test"))
                      )
                @Html.ValidationMessageFor(model => model.ClientType)

But,on building, I get the error:

Error 67 'System.Web.Mvc.MvcHtmlString' does not contain a definition for 'Events' and no extension method 'Events' accepting a first argument of type 'System.Web.Mvc.MvcHtmlString' could be found (are you missing a using directive or an assembly reference?) C:\WorkingForlder_Details.cshtml 193 32 NameSpace.ToApplication

NB: The data binding and everything else works. It is the Event Binding that's failing

Any idea why its failing to build?

1
remove .ToClientTemplate() and put at the end after .Events and tryRudresha Parameshappa
Thanks Rudresh. That did it! Please make it an answer and I will mark it as one.user919426

1 Answers

1
votes

remove .ToClientTemplate() and put at the end after .Events and try