2014-08-29 77 views
0

我是MVC和Kendo UI中的新手,使用Kendo UI MVC使用Ajax綁定創建Grid,並使用編輯器模板在一列中添加組合框。當我在組合框中選擇,它將顯示DataValueField在列(DistDetSubName),但列DistDetID不顯示的東西..我怎樣才能獲得DataTextField組合框(DistDetID)?在Kendo UI中使用Editor模板更新列MVC

與編輯模板格列像下面的代碼:

columns.Bound(e => e.BatNbr).Hidden(true); 
columns.Bound(e => e.RecordID).Hidden(true); 
columns.Bound(e => e.DistDetID).EditorTemplateName("test"); 
columns.Bound(e => e.DistDetSubName); 

守則test.cshtml在編輯模板文件夾:

@model string 

@(Html.Kendo().ComboBox() 
         .Name("DistDetSubName") 
           .DataTextField("DistDetID") 
           .DataValueField("DistDetSubName") 

     .DataSource(source => 
     { 
      source.Read(read => 
      { 
       read.Action("GetDist", "DM"); 

      }) 
      .ServerFiltering(false); 
     }) 

回答

0

守則test.cshtml在編輯模板文件夾:

@model string 

@(Html.Kendo().ComboBox() 
        .Name("DistDetID") 
          .DataTextField("DistDetSubName") 
          .DataValueField("DistDetID") 

    .DataSource(source => 
    { 
     source.Read(read => 
     { 
      read.Action("GetDist", "DM"); 

     }) 
     .ServerFiltering(false); 
    }) 

Refrence Link

相關問題