title: Why Is `data(“kendogrid”)` Undefined?
body: <p>I'm a starter in kendo.ui, I've written this code to create kendo.ui.grid</p>
  
  <pre><code>@(Html.Kendo().Grid&lt;BrandViewModel&gt;(Model)
      .Name("Grid")
      .Columns(columns =&gt;
      {
          columns.Bound(p =&gt; p.BrandName);
          columns.Bound(p =&gt; p.BrandAbbr);
          columns.Bound(p =&gt; p.SrcImage);
  
          columns.Command(command =&gt; command.Custom("Edit").Click("editItem"));
  
      })
  
      .DataSource(dataSource =&gt; dataSource
          .Ajax()
          .Read(read =&gt; read.Action("CustomCommand_Read", "Brand"))
          .Model(model =&gt; model.Id(p =&gt; p.Id))
      )
  )
  </code></pre>
  
  <p>When the user clicks the edit button in grid it will show Edit view in kendo.ui.window and the user can edit data. </p>
  
  <pre><code>@(Html.Kendo().Window().Name("Details")
      .Title("Customer Details")
      .Visible(false)
      .Modal(true)
      .Height(400)
      .Draggable(true)
      .Width(300)
      .Events(events =&gt; events.Close("onClose"))
  )
  
  &lt;script type="text/x-kendo-template" id="template"&gt;
      &lt;div id="details-container"&gt;
          &lt;!-- this will be the content of the popup --&gt;
          BrandName: &lt;input type='text' value='#= BrandName #' /&gt;
      &lt;/div&gt;
  &lt;/script&gt;
  
  
  &lt;script type="text/javascript"&gt;
      var detailsTemplate = kendo.template($("#template").html());
      var windowObject;
  
      $(document).ready(function () {
          windowObject = $("#Details").data("kendoWindow");
      });
  
      function editItem(e) {
          e.preventDefault();
  
          var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
  
          windowObject.refresh({
              url: "/Brand/Edit/" + dataItem.Id
          });
          windowObject.center().open();
      }
  
      function onClose(e) {
          var grid = $("#Grid").data("kendoGrid").dataSource.read();
  
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>but in <code>onClose</code> method <code>$("#Grid").data("kendoGrid")</code> is Undefined, please help me, thanks all</p>