title: asp.net Kendoui cannot access grid from code?
body: <p>I want to access my grid from Javascript code but I have mistakes somewhere. Where?</p>
  
  <p><strong>Here is my Grid code:</strong> </p>
  
  <pre><code> &lt;div id="kendoo"&gt;
  @(Html.Kendo().Grid&lt;SalePortal.ServiceReference.Product&gt;()
  .Name("Grid")
  .Columns(columns =&gt;
      {
          columns.Bound(product =&gt; product.pID).Title("Product ID");
          columns.Bound(product =&gt; product.productName).Title("Product Name");
          columns.Bound(product =&gt; product.productPrice).Title("Price");
          columns.Command(command =&gt; command.Custom("Buy").Click("Sale"));
      })
      .DataSource(dataSource =&gt; dataSource
      .Ajax()
      .ServerOperation(false)
      .Read(read =&gt; read.Action("GetProduct","Home"))
      )
  
  )
  &lt;/div&gt;
  </code></pre>
  
  <p>And here is my javascript code:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  
      function Sale(e)
      {
          var grid = $("#kendoo").data("kendoGrid");
          var myvar = grid.dataItem($(this).closest("tr"));
          alert(my.pID);
  
  
          var url = "@Url.Action("Sale", "Home")";
          $.ajax({
              url: url,
              type: 'POST',
              data: { cID: 1, pID: prID },
          });
       }
  &lt;/script&gt;
  </code></pre>
  
  <p>The variable <code>grid</code> in javascript part shown as "undefined" when I run the website. Then It gives an error like :</p>
  
  <pre><code>"Javascript runtime error: dataItem of undefined or null reference"
  </code></pre>
  
  <p>I think because grid is undefined I get this error. How could I make this correct? I need to access selected row cell.</p>