2013-07-25 124 views
0
提前

謝謝...KendoUI DropDownList的使用JavaScript

我是新來KendoUI控件來填充數據結果的文本框,並試圖解決我遇到的問題與在改變的項目更新文本字段Kendo DropDownList控件。

我在加載視圖時使用ViewData方法填充DropDownList,然後調用返回特定行然後用於填充文本框字段的Json結果方法。

我能夠擊中Json事件,但由於某種原因,我在我的jquery.min.js(jQuery v1.9.1)文件中出現錯誤,並且函數(數據)永遠不會熄滅,它只是跳過它共。

下面是我從jquery.min.js文件得到錯誤...

GET http://localhost:52078/Settings/GetEtilizeLocale/7 500 (Internal Server Error)  jquery.min.js:19 
b.ajaxTransport.send jquery.min.js:19 
b.extend.ajax jquery.min.js:19 
b.each.b.(anonymous function) jquery.min.js:19 
ddlChange ViewLocales:192 
i.extend.trigger kendo.all.min.js:9 
o.extend._change kendo.all.min.js:14 
o.extend._blur kendo.all.min.js:14 
o.extend._focus kendo.all.min.js:14 
o.extend._accept kendo.all.min.js:15 
o.extend._click kendo.all.min.js:14 
b.extend.proxy.b.isFunction.i jquery.min.js:4 
b.event.dispatch jquery.min.js:4 
b.event.add.v.handle 

這裏是我的代碼...

JS查看

//Auto populate other edit popup fields when ddl changes value 

    function ddlChange(e) {    
     $.get("/Settings/GetEtilizeLocale/" + $("#EtilizeLocaleID").data().kendoDropDownList.value(), function (data) 
     { 
      alert($('#Name').value()); 
      //$('#Name').val(data.name); 
      //$('#LanguageCode').val(data.languagecode); 
      //$('#CountryCode').val(data.countrycode); 
      //$('#IsActive').val(data.isactive); 
     });    
    } 

C#控制器

public ActionResult GetEtilizeLocale(int id = 0) 
    { 
     var dataContext = new EtilizeEntities(); 
     Etilize_Locale loc = dataContext.Etilize_Locale.Find(id); 

     return Json(loc); 
    } 

回答

0

終於明白了!

不得不改變

return Json(loc) 

return Json(loc, JsonRequestBehavior.AllowGet); 

對於其他人誰願意冒這個問題。