Note that there are some explanatory texts on larger screens.

plurals
  1. POKendo Grid DetailTemplate, condition expression of accessing SubGrid value
    primarykey
    data
    text
    <p>I have a Master/Child grid structure like so:</p> <p>Parent Grid:</p> <pre><code>@(Html.Kendo().Grid&lt;ElementViewModel&gt;() .Name("gridEle") .Columns(cols =&gt; { cols.Bound(e =&gt; e.EleNum) }) .DataSource(dataSource =&gt; dataSource .Ajax() .Read(read =&gt; read.Action("GetElements", "Rating", pi)) ) .ClientDetailTemplateId("tempSubEle") ) </code></pre> <p>Child Grid as DetailTemplate:</p> <pre><code> &lt;script id="tempSubEle" type="text/kendo-tmpl"&gt; @(Html.Kendo().Grid&lt;SubElementViewModel&gt;() .Name("gridSubEle_#=EleID#") .Columns(cols =&gt; { cols.Bound(e =&gt; e.Rating) .ClientTemplate("&lt;input type='checkbox' value='1' " + "#if(Rating==1){#checked='checked'#}# /&gt;" ); }) .DataSource(dataSource =&gt; dataSource .Ajax() .Read(read =&gt; read.Action("GetSubElementsByElementID", "Rating", new {eID = "#=EleID#" })) ) .ToClientTemplate() ) &lt;/script&gt; </code></pre> <p><strong>The Problem:</strong></p> <p>I have a #if{# ... #}# statement in the column ClientTemplate, however the Rating value is from the Parent Grid not the current Child Grid (Parent Grid happen has a column also named 'Rating'), to prove that it is from Parent Grid, if I change Rating to a column that only exists in the Child grid, i.e. SubEleID, it gives error at browser, saying that SubEleID is not found.</p> <p><strong>The Question:</strong></p> <p>so what is the syntax for Rating gets the Child Grid value? just for the sake of trying, I even tried: data.Rating, or $(this).Rating, none worked.</p> <p>Please advise, Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload