asp.net mvc - Kendo UI Grid - MVC - Looping collection of entity (view model) on ClientRowTemplate -


is possible create clientrowtemplate entity model includes complex type of list display fields? i've created server side rowtemplate when switch ajax on datasource, doesn't work. think it's expected. how create complex template display collections ajax custom row template on mvc?

solved

for clean code, seperate delegate other code block. notice tostring() @ end of code result string, not helperresult.

@{     func<grid<mymodel>, string> clientrowtemplate = @<div class="order-info">         <div class="order-info-items cell">         # if (data.orderitemlist) { #             # (var in data.orderitemlist) { #                 # if (data.orderitemlist[i].id) { #                     <img src="#= data.orderitemlist[i].imageurl #" alt="#= data.orderitemlist[i].itemname #" width="100" height="100" />                 # } #             # } #         # } #         </div>     </div>.tostring(); } 

then pass parameter clientrowtemplate method:

@(html.kendo().grid(model)     .name("grd")     .columns(columns =>     {         /*columns*/     })     .datasource(datasource => datasource         .ajax()         .read(read => read.action("orders_read", "home"))     )     .clientrowtemplate(clientrowtemplate) 

hope helps.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

monitor web browser programmatically in Android? -

c# - Using multiple datasets in RDLC -