title: Partial View - >> How to REFRESH the HTML content without having to redirect to the view
body: <p>My site has a concept like Skype that allow users to go "Online" and "Offline". I created a partial view that allows the user to switch mode:</p>
  
  <pre><code>@if (Convert.ToBoolean(ViewData["IsLogged"].ToString()))
  {
  &lt;div id="onlineStatus"&gt;
      You are currently &lt;strong&gt;ONLINE&lt;/strong&gt; &gt;&gt;
      @Html.ActionLink("Go OFFLINE", "GoOffline", "Account")
  &lt;/div&gt;
  }
  else
  {
  &lt;div id="offlineStatus"&gt;
      Ready for business &gt;&gt;
      @Html.ActionLink("Go ONLINE", "GoOnline", "Account")
  &lt;/div&gt;           
  }
  </code></pre>
  
  <p>This is how we load the Partial View:</p>
  
  <pre><code>public ActionResult OnlineStatusCtrl()
  {
       if (SiteUser.IsAuthenticated)
          ViewData["IsLogged"] = SiteUser.IsOnline.ToString();
  
        return PartialView("OnlineStatusCtrl");
  }
  </code></pre>
  
  <p>When a user clicks on the link "Go ONLINE" or "Go OFFLINE", the Controller respond as:</p>
  
  <pre><code>public ActionResult GoOnline()
  {
      if (SiteUser.IsAuthenticated)
          SiteUser.GoOnline();
  
      ViewData["IsLogged"] = "True";
  
      return RedirectToAction("Index", "Home");
      //return PartialView("OnlineStatusCtrl");
      //return EmptyResult();
  }
  
  public ActionResult GoOffline()
  {
      if (SiteUser.IsAuthenticated)
          SiteUser.GoOffline(true);
  
      ViewData["IsLogged"] = "False";
  
      return RedirectToAction("Index", "Home");
  }
  </code></pre>
  
  <p>This works well ...but the ONLY problem is that if I am on View XXXX, and I click on "Go Online", the controller redirects me to the Index View.</p>
  
  <p>I tried "return EmptyResult()" or "return PartialView("OnlineStatusCtrl") but it does just not work.</p>
  
  <p>From the code, you can see that the only thing the PartialView cares about is the "ViewData['IsLogged'] value"</p>
  
  <p>QUESTION:
  What is the way to REFRESH a partial view without having to refresh the entire page or redirect to the main page?</p>
  
  <p>Is it maybe a matter of putting an Html.Beginform() ?
  Is it maybe a matter of the Controller returning something that just refresh the content of the PartialView independently from what view is holding the PV itself? </p>
  
  <p>Aiaiaiaia 
  I still can't figure out how MVC works with PartialViews/</p>
  
  <p>Many Many thanks<br>
  ...in advanced</p>
  
  <hr>
  
  <p>UPDATE
  I have updated the code as x suggested and the HTML output is as follow:  </p>
  
  <pre><code>&lt;div id="divStatus"&gt;
      &lt;form action="/" data-ajax="true" data-ajax-mode="replace" data-ajax-update="#divStatus" id="form0" method="post"&gt;        
          &lt;div id="offlineStatus"&gt;
              Ready for business &gt;&gt;
              &lt;a href="/Account/GoOnline"&gt;Go Online&lt;/a&gt;
          &lt;/div&gt;
     &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I click on the LINK, the Controller <code>return PartialView("_OnlineStatusCtrl");</code> which is hte name of the calling PV ...and the <strong>ENTIRE PAGE</strong> gets replaced.</p>