title: ajax.beginform() not updating partial view mvc
body: <p>I am trying to do something like updatepanel in asp.net.  Page A display stuff and a div that partial render another view (Page B) with 2 buttons in it.  Depend on which the button, the partial view (Page B) will re-update it content. The 1st time the page load, the partial view display correct. When a button click in the page B, only the view of B is display, Page A is lost.</p>
  
  <pre><code>Page A:
  @{
  DemoMVC.Models.FlashADrugModel displayDrug = null;
  int drugIndex = 0;
  
  Session["drugIndex"] = drugIndex;
  
  if (Session["userDrugArray"] != null)
  {
      DemoMVC.Classes.Drug[] myDrugArray = (DemoMVC.Classes.Drug[])Session["userDrugArray"];
  
      if(myDrugArray.Length&gt;0)
      {
          displayDrug = new FlashADrugModel { displayDrug = myDrugArray[drugIndex], nullAble = false };
      }
  }
  }
  
  @using (Ajax.BeginForm("FlashACard", "FlashCard", null, new AjaxOptions() { UpdateTargetId = "updateRegion", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" }))
  {
      @Html.AntiForgeryToken()
      &lt;div id="updateRegion"&gt;
          @Html.Partial("_FlashACard", @displayDrug)
      &lt;/div&gt;
  
      &lt;input type="submit" value="Previous" name="ButtonType"&gt;&lt;input type="submit" value="Next" name="ButtonType"&gt;
  }
  </code></pre>
  
  <p>....</p>
  
  <pre><code>Page B:    
  &lt;dl class="dl-horizontal"&gt;
      &lt;dd&gt;
          @Html.DisplayFor(model =&gt; model.displayDrug.DrugBrand)
      &lt;/dd&gt;
  &lt;/dl&gt;
  </code></pre>
  
  <p>.....</p>
  
  <pre><code>Controller:
  public ActionResult Index()
      {
          //List&lt;Drug&gt; myDrugList =  this.cardRepository.GetAllDrugs();
          List&lt;Drug&gt; myDrugList = new DrugCardsRepository().GetAllDrugs();
  
          Session["userDrugArray"] = myDrugList.ToArray();
  
          return View();
      }
  
      public PartialViewResult FlashACard(FlashADrugModel drugModel, string ButtonType)
      {
          if(!drugModel.nullAble.HasValue)
          {
              if (Session["userDrugArray"] != null)
              {
                  Drug[] myDrugArray = (Drug[])Session["userDrugArray"];
  
                  //Default drug index 0
                  int drugIndex = 0;
  
                  if (Session["drugIndex"] != null)
                  {
                      drugIndex = (int)Session["drugIndex"];
                  }
  
                  if (ButtonType == "Next")
                  {
                      if(drugIndex &lt; myDrugArray.Length -2)
                      {
                          drugIndex++;
                      }
                  }
                  if (ButtonType == "Previous")
                  {
                      if (drugIndex &gt; 0)
                      {
                          drugIndex--;
                      }
                  }
  
                  Session["drugIndex"] = drugIndex;
  
                  drugModel = new FlashADrugModel { displayDrug = myDrugArray[drugIndex], nullAble = false };
              }
          }
  
          return PartialView("_FlashACard",drugModel);
      }
  </code></pre>