c# - Viewing foreignkey in Kendo UI Grid -


i have problems navigate table in kendo grid.

in grid, there column id , i, of course prefer display name instead. achieve this, need go in language table.

here code:

model:

    public dbset<userprofile> userprofiles { get; set; }     public dbset<language> language { get; set; }     public dbset<noteform> note { get; set; }  [table("language")] public class language {     public string lang { get; set; }      [key]     public int id { get; set; } } [table("note")]  public class noteform {     [required]     [stringlength(100, errormessage = "the {0} must @ least {2} characters long.", minimumlength = 6)]     [display(name = "title")]     public string title { get; set; }      [required]     [display(name = "text")]     public string text { get; set; }      [required]     [display(name = "language")]     [foreignkey("language")]     public int languageid { get; set; }      [key]     public int id { get; set; }      public int userid { get; set; }  } 

view :

@(html.kendo().grid<developmentnotesproject.models.noteform>() .name("grid") .columns(columns => {     columns.bound(c => c.title).width(200).clienttemplate(string.format("{0}...", "#= formatter(title) #"));     columns.bound(c => c.text).width(450).clienttemplate(string.format("{0}...", "#= formatter(text) #"));     columns.foreignkey(p => p.languageid, (system.collections.ienumerable)viewdata["language"], "id", "lang").title("language").width(100);     columns.command(command => { command.edit(); command.destroy(); });  }) .htmlattributes(new { style = "height: 380px;" }) .scrollable() .groupable() .sortable() .pageable(pageable => pageable     .refresh(true)     .pagesizes(true)     .buttoncount(5))  .datasource(datasource => datasource // configure grid data source           .ajax() // specify ajax binding used           .read(read => read.action("notes_read", "mynotes")) // set action method return data in json format           .destroy(update => update.action("notes_destroy", "mynotes"))           .update(update => update.action("notes_update", "mynotes"))           .model(model =>                {                   model.id(p => p.id);               })        )  .selectable() ) 

in view code, tried write :

  columns.foreignkey(p => p.language.id, (system.collections.ienumerable)viewdata["language"], "id", "lang").title("language").width(100); 

but keep following error :

error 2 cannot convert lambda expression type 'string' because not delegate type

need suggestions , hints on going wrong here , how resolve this.

i tried doing , have no error. ide using , did try clean , rebuild?

just thought i'd answer in here in case want accept answer.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -