c# - Create DetailView for Telerik MVC Grid only on certain conditions -


i know there question conditional detailview, feel that's not i'm looking for. i've been messing around telerik grid mvc, , i've managed create detailview rows in grid. thing of now, detailview filled html-code, , want have new model inside.

based on 1 columns value, want create detailview rows matching columns value. so, instance, if column "type" equals fruit, shall create detailview (with "+" sign). if "type" vegetable, should not create detailview (without "+" sign).

my current code looks this:

html.telerik().grid<searchviewmodel>(model)         .name("search")                     .columns(columns =>                     {                         columns.bound(o => o.type).width(60);                         //etc.                     })         //.prefixurlparameters(false)         .detailview(detailview => detailview.clienttemplate(             "<div>" +             "<h5><span>details type:</span></h5><div><#= detailstype #></div>" +             "</div>"         )) 

as can see, i'm create detailview every row in grid.

also, i've found javascript hides plussign conditions, doesn't work on initial load (only after i've made filtering, paging or refresh request).the script bound .onrowdatabound.

function hideplussign(e) {     var row = e.row;     var dataitem = e.dataitem;      if (dataitem.type != "fruit") {         $('a.t-icon', e.row.cells).css('display', 'none');      } 

what need add condition in detail view, this:

"<# if (detailstype == 'mytype') { #>" +         "<div>some html code here</div>" + "<# } else { #>" +     "<div>another html code here</div>" + "<# } #>" + 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -