2014-03-03 50 views
1

我目前使用的是使用ASP.Net MVC Razor語法的KendoUI。KendoUI DropDownListFor事件綁定 - 錯誤:「不包含事件定義」

我有下拉列表和編輯器小工具,運行良好。

當我需要將事件綁定到JS函數時,問題就出現了。

我也跟着在這裏找到文檔:http://demos.telerik.com/kendo-ui/web/dropdownlist/events.html

在我的部分觀點:

@(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) 

但是,在建築,我得到的錯誤:

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

注:數據綁定和其他一切工作。這是事件綁定失敗

任何想法爲什麼它未能建立?

+1

刪除.ToClientTemplate(),並把在.Events後結束,並嘗試 –

+0

感謝Rudresh。那樣做了!請讓它成爲答案,我會將其標記爲一個答案。 – user919426

回答

1

刪除.ToClientTemplate()和.Events後年底建成並試