title: Kendo ASP.Net MVC Datagrid how to get Parent Row Id in child rows
body: <p>I have a parent hierarchy grid that have a child table for each of the parent row. I have a custom command button in child table rows and want to access the parent row ID when I press that button. Here is my code : </p>
  
  <p>Parent Table : </p>
  
  <pre><code>    @(Html.Kendo().Grid&lt;FsERP.Models.ParentModel&gt;()
              .Name("gridParent")
              .Columns(columns =&gt;
              {
                  columns.Bound(p =&gt; p.ID).Hidden(true);
                  columns.Bound(p =&gt; p.P_Column1).Width(180);
                  columns.Bound(p =&gt; p.P_Column2).Width(180);
              })
              .DataSource(dataSource =&gt; dataSource
              .Ajax()
              .Batch(true)
              .ServerOperation(false)
              .Model(model =&gt;
              {
                  model.Id(p =&gt; p.ID);
                  model.Field(p =&gt; p.ID).Editable(false););
              })
              .PageSize(20)
              .Read(read =&gt; read.Action("EditingCustom_Read", "Parent"))
          ).ClientDetailTemplateId("childsTemplate")
  </code></pre>
  
  <p>Child Table Template : </p>
  
  <pre><code>        &lt;script type="text/kendo" id="childsTemplate"&gt;
  
               @(Html.Kendo().Grid&lt;FsERP.Models.ChildModel&gt;()
                          .Name("gridChild")
                          .Events(e =&gt; e.DataBound("OnDataBound").Edit("OnEdit"))
                          .Columns(columns =&gt;
                          {
                              columns.Bound(c =&gt; c.ID).Hidden(true);
                              columns.Bound(c =&gt; c.C_Column1).Width(180);
                              columns.Bound(c =&gt; c.C_Column2).Width(130);
                              columns.Command(command =&gt;command.Custom("GetParentID").Click("showParentID")).Width(80);
      }).DataSource(dataSource =&gt; dataSource
              .Ajax()
              .Batch(true)
              .ServerOperation(false)
              .Model(model =&gt;
              {
                  model.Id(p =&gt; p.ID);
                  model.Field(p =&gt; p.ID).Editable(false););
              })
              .PageSize(20)
              .Read(read =&gt; read.Action("EditingCustom_Read", "Child"))
          ).ToClientTemplate()
  )
  
               &lt;/script&gt;
  </code></pre>
  
  <p>Here is my javascript click method : </p>
  
  <pre><code>function showParentID(e) {
  
  }
  </code></pre>
  
  <p>How would I alert the parent ID inside this showParentID() method. Any help would be appreciable.</p>
  
  <p>Thanks.</p>
  
  <p><strong>NOTE</strong></p>
  
  <p>I dont want to send the parentID in parameter of the javascript method as I also need to access the event information.</p>