title: manually Set Kendo asp.net mvc grid row to update
body: <p>My grid is edited in inline mode.  apparently when kendo doesnt detect a change to d row, the update event will not be fired. i need to cause the update event to fire even when no change has been made on the row because the change will be handled in d controller.</p>
  
  <p>i found this post <a href="http://www.telerik.com/forums/manually-set-grid-row-as-dirty" rel="nofollow">Manual row change</a>  but i dont know how to hook that up . im using kendo mvc not the kendo js.</p>
  
  <p>my view </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
          .Name("orders")
                  .HtmlAttributes(new { style = "height: 700px; border: 0;" })
          .Scrollable()
          .Columns(columns =&gt;
          {
              columns.Template(t =&gt; { })
                  .ClientTemplate("#=OrderID#")
                  .Title("ORDER ID")
                  .Width(120);
              columns.Bound(f =&gt; f.OrderDate)
                 .Title("ORDER DATE")
                 .Format("{0:d}")
                 .Width(150);
              columns.Bound(f =&gt; f.RequiredDate)
                 .Title("REQUIRED DATE")
                 .Format("{0:d}")
                 .Width(150);
              columns.ForeignKey(f =&gt; f.CustomerID, (System.Collections.IEnumerable)ViewData["customers"], "CustomerID", "CompanyName")
                  .Title("REQUEST BRANCH")
                  .Width(200);
              columns.ForeignKey(f =&gt; f.ShipVia, (System.Collections.IEnumerable)ViewData["shippers"], "ShipperID", "CompanyName")
                  .Title("CMU")
                  .Width(150); ;
              columns.ForeignKey(f =&gt; f.EmployeeID, (System.Collections.IEnumerable)ViewData["employees"], "EmployeeID", "EmployeeName")
                  .Title("REQUESTED BY")
                  .Width(250);
              columns.Bound(f =&gt; f.ShipCountry)
                  .Title("ORDER STATUS")
                  .ClientTemplate("&lt;div class='country #=ShipCountry#'&gt;&lt;/div&gt;#=ShipCountry#")
                  .Width(150);
              columns.Command(commands =&gt;
              {
                  commands.Edit()
                  .Text("Approve Order")
                   .UpdateText("Approve")
                   .CancelText("Cancel");
  
              }).Width(200);
          })
          .Editable(e =&gt; e.Mode(GridEditMode.InLine))
          .Events(e =&gt; e
              .DataBound("onDataBound")
          )
          .Pageable(pageable =&gt; pageable.Refresh(true))
          .Sortable()
          .Selectable()
          .Navigatable()
          .Filterable()
          .ClientDetailTemplateId("Order_DetailTemplate")
          .DataSource(dataSource =&gt; dataSource
              .Ajax()
              .PageSize(20)
              .Model(m =&gt;
              {
                  m.Id(f =&gt; f.OrderID);
                  m.Field(f =&gt; f.OrderID).DefaultValue(-42); 
                  m.Field(f =&gt; f.OrderID).Editable(false);
                  m.Field(f =&gt; f.OrderDate).Editable(false);
                  m.Field(f =&gt; f.CustomerID).Editable(false);
                  m.Field(f =&gt; f.EmployeeID).Editable(false);
                  m.Field(f =&gt; f.ShipCountry).Editable(false);
                      
                  m.Field(f =&gt; f.ShipVia).Editable(false);
                      
                  
              })
              .Events(e =&gt; e.Error(@&lt;text&gt;
                  function (e) {
                  onError(e, "orders");
                  }
              &lt;/text&gt;))
                                      .Sort(s =&gt; s.Add(f =&gt; f.OrderDate).Descending())
                                      .Read("Orders_Read", "Orders")
  
                                      .Update("Orders_Approve", "Orders")
                                      
                                  )
      )
      @{
          Func&lt;object, object&gt; errorEvent = @&lt;text&gt;
              function(e) {
              if (e.errors) {
              onError(e, "order_details#=OrderID#");
              }
              }
          &lt;/text&gt;;
      }
      &lt;script id="Order_DetailTemplate" type="text/x-kendo-tmpl"&gt;
          &lt;h4&gt;Details for order \\##=OrderID# &lt;/h4&gt;
          @(Html.Kendo().TabStrip()
          .Name("order_details_tabstrip_#=OrderID#")
          .Items(items =&gt;
          {
              items.Add()
                  .Text("CURRENCIES")
                  .Selected(true)
                  .Content(@&lt;text&gt;
                      @(Html.Kendo().Grid&lt;OrderDetailViewModel&gt;()
                      .Name("order_details#=OrderID#")
                      
                      .Columns(columns =&gt;
                      {
                          columns.ForeignKey(f =&gt; f.ProductID, (System.Collections.IEnumerable)ViewData["products"], "ProductID", "ProductName")
                              .Title("CURRENCY NAME")
                              .EditorTemplateName("CustomGridForeignKey");
                          columns.Bound(f =&gt; f.UnitPrice)
                              .Format("{0:c}")
                              .Title("UNIT PRICE")
                              .Width(220);
                          columns.Bound(f =&gt; f.Quantity)
                              .Title("AMOUNT")
                              .Width(220)
                              .ClientFooterTemplate("Grand total:");
                          columns.Template(f =&gt; new { })
                              .Title("TOTAL")
                              .ClientTemplate("\\#=kendo.toString(GetOrderItemPrice(data), \"c\")\\#")
                              .ClientFooterTemplate("&lt;span name='sum'&gt;&lt;/span&gt;").Width(120);
  
                      })
                      .Events(e =&gt;
                      {
                          e.DataBound("onOrderDetailsDataBound");
                          e.DetailInit("onDetailInit");
                          e.Edit("onOrderDetailsEdit");
                      })
                      .Selectable()
                      .Pageable(pageable =&gt; pageable.Refresh(true))
                      .Navigatable()
                      .ClientDetailTemplateId("Product_DetailTemplate")
                      .DataSource(dataSource =&gt; dataSource
                          .Ajax()
                          .Model(model =&gt;
                          {
                              model.Id(detail =&gt; detail.OrderDetailID);
                          })
                          .Events(e =&gt; e.Error(errorEvent))
                          .Read("OrderDetails_Read", "OrderDetails", new { OrderID = "#=OrderID#" })
                          
                      ).ToClientTemplate()
                      )&lt;/text&gt;);
              items.Add()
                  .Text("MOVEMENT DETAILS")
                  .Content(@&lt;text&gt;
                      &lt;div class='shipping-details'&gt;
                          &lt;ul&gt;
                              &lt;li&gt;&lt;label&gt;Name:&lt;/label&gt;#= ShipName #&lt;/li&gt;
                              &lt;li&gt;&lt;label&gt;OrderStatus:&lt;/label&gt;#= ShipCountry #&lt;/li&gt;
                              &lt;li&gt;&lt;label&gt;City:&lt;/label&gt;#= ShipCity #&lt;/li&gt;
                              &lt;li&gt;&lt;label&gt;Address:&lt;/label&gt;#= ShipAddress #&lt;/li&gt;
                              &lt;li&gt;&lt;label&gt;Postal Code:&lt;/label&gt;#= ShipPostalCode #&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/div&gt;
                  &lt;/text&gt;);
          })
                                                                          .ToClientTemplate()
          )
      &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>and my controller :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public ActionResult Orders_Approve([DataSourceRequest]DataSourceRequest request, OrderViewModel order)
          {
              if (ModelState.IsValid)
              {
                  using (var northwind = new NCashEntities())
                  {
                      var entity = northwind.ORDERS.FirstOrDefault(o =&gt; o.ORDERID == order.OrderID);
                      if (entity == null)
                      {
                          string errorMessage = string.Format("Cannot update record with OrderID:{0} as it's not available.", order.OrderID);
                          ModelState.AddModelError("", errorMessage);
                      }
                      else
                      {
                          entity.CUSTOMERID = order.CustomerID;
                          entity.EMPLOYEEID = order.EmployeeID;
                          entity.ORDERDATE = order.OrderDate;
                          entity.SHIPCOUNTRY = "Approved";
                          entity.SHIPVIA = order.ShipVia;
                          entity.SHIPPEDDATE = order.ShippedDate;
                          entity.SHIPNAME = order.ShipName;
                          entity.SHIPADDRESS = order.ShipAddress;
                          entity.SHIPCITY = order.ShipCity;
                          entity.SHIPPOSTALCODE = order.ShipPostalCode;
  
                          northwind.ORDERS.Attach(entity);
                          northwind.Entry(entity).State = System.Data.Entity.EntityState.Modified;
                          northwind.SaveChanges();
                      }
                  }
              }
              return Json(new[] { order }.ToDataSourceResult(request, ModelState));
          }</code></pre>
  </div>
  </div>
  </p>