title: Reloading View on Model Change
body: <p>I believe I'm aware of the problem i'm having; I just don't know how to resolve it. My view controller takes two parameters. When it's first loaded it gets one parameter and loads partial model. As soon as a selection is made from the grid on the page, the controller method is called again and the model is loaded with both parameters and returned to the view. </p>
  
  <p>This all works perfectly, but when the additional data is added to the model it does not show up on screen. When I run it in debug I see the data in the view, it just doesn't show up on screen. </p>
  
  <p>My guess is that this is because I need to reload the page, but I'm not entirely sure how to do that. Also, if anyone could comment and let me know if the workflow I'm using to accomplish the loading of additional data is correct, or if there is a better way. </p>
  
  <p>Thanks!</p>
  
  <p><strong>EventsController</strong></p>
  
  <pre><code>public class EventsController : Controller
  {
      //
      // GET: /Events/
      public ActionResult Events(string sName, int? iID)
      {
          ViewBag.AppName = sName;
          EventReader ereader = new EventReader(sName);
          Events _events = new Events();
          _events.LoggedEvents = ereader.GetListOfEvents().ToDataTable();
          //_events.EventDetails.Severity = "TEST";
          if (iID != null)
          {
              _events.EventDetails = ereader.GetEvent((int)iID);
          }
  
          return View(_events);
      }
  
      public ActionResult Read([DataSourceRequest] DataSourceRequest request, string sLogName)
      {
          EventReader ereader = new EventReader(sLogName);
          return this.Json(ereader.GetListOfEvents().ToDataTable().ToDataSourceResult(request));
      }
  }
  </code></pre>
  
  <p><strong>Events.cshtml</strong></p>
  
  <pre><code>@model Models.Events
  
  @{
      Layout = "~/Views/Shared/_Layout.cshtml";
  }
  
  &lt;h2&gt;Events for @ViewBag.AppName&lt;/h2&gt;
  
  &lt;!-- HEADER GRID --&gt;
  &lt;div id="Events"&gt;
      @(Html.Kendo().Grid(Model.LoggedEvents)
            .Name("EventGrid")
            .Events(events =&gt; events.Change("eventGridHandler"))
            .Columns(columns =&gt;
                         { 
                             columns.Bound("EntryType");
                             columns.Bound("EventDate");
                             columns.Bound("Source");
                             columns.Bound("ID");
                             //foreach (System.Data.DataColumn column in Model.Columns)
                             //{
                             //    columns.Bound(column.ColumnName);
                             //}
                         })
            .Pageable()
            .Sortable()
            .Selectable(select =&gt; select
                                      .Enabled(true)
                                      .Mode(GridSelectionMode.Single)
                                      .Type(GridSelectionType.Row)
            )
            .DataSource(dataSource =&gt; dataSource
                                          .Ajax()
                                          .Model(model =&gt;
                                                     {
                                                         model.Field("EntryType", typeof(string));
                                                         model.Field("EventDate", typeof(DateTime));
                                                         model.Field("Source", typeof(string));
                                                         model.Field("ID", typeof (int));                                                
                                                         model.Id("ID");
                                                         //foreach (System.Data.DataColumn column in Model.Columns)
                                                         //{
                                                         //    model.Field(column.ColumnName, column.DataType);
                                                         //}                
                                                     })
                                          .Read(read =&gt; read.Action("Read", "Events")
                                                            .Data("eventGridBindingData")
                                          )
            ))
  &lt;/div&gt;
  
  &lt;!-- DETAIL AREA --&gt;
  
  &lt;div id="EventDetail"&gt;
      &lt;div id="Data"&gt;
          @(Html.TextArea("EventData", Model.EventDetails.EventData))
      &lt;/div&gt;
      &lt;div id="Details"&gt;
          &lt;!-- Detail Table Goes Here --&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;User&lt;/td&gt;
                  &lt;td&gt;Location&lt;/td&gt;
                  &lt;td&gt;Severity&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;@(Model.EventDetails.UserID)&lt;/td&gt;
                  &lt;td&gt;@(Model.EventDetails.LocationID)&lt;/td&gt;
                  &lt;td&gt;@(Model.EventDetails.Severity)&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;!-- Page Scripts --&gt; 
  &lt;script type="text/javascript"&gt;
  
      // Return additional data to the reader
      function eventGridBindingData() {
          return {
              name: '@ViewBag.AppName'
          };
      }
  
      // Handler for the EventGrid
      function eventGridHandler(e) {
          var data = this.dataItem(this.select());
          var appName = '@ViewBag.AppName';
          console.log("in event");
          jQuery.ajax({
              url: 'Events',
              data: { 'sName' : appName, 'iID' : data.id },
              type: "POST",
              cache: false
          });
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Events.cs (model)</strong></p>
  
  <pre><code>public class Events
  {
      #region PROPERTIES
  
      public DataTable LoggedEvents { get; set; }
      public CEventMessage EventDetails { get; set; }
  
      #endregion
  
      #region CONSTRUCTORS
  
      public Events()
      {
          LoggedEvents = new DataTable();
          EventDetails = new CEventMessage();
      }
  
      #endregion
  }
  </code></pre>