title: Render Views with Data as Query Strings Parameters
body: <p>I have a controller that accepts several parameters for the index action. This controller returns a view by leveraging a lync to sql query as a PageList. <code>return View(agreements.ToPagedList(pageNumber, pageSize));</code> </p>
  
  <p>I have a map on this page of which a user can zoom and pan. if the page is reloaded the map reloads to its default extent. I have some inputs that I post the extent parameters as the user manipulates the map. </p>
  
  <p>What I need is to be able to capture these parameters so that when the view is reloaded/rendered... It renders with the extents parameters in the query string. I have coded javascript that handles the map to be able to pull these parameters from the URL and zoom to the appropriate location on the map. </p>
  
  <p>I have 6 inputs that are manipulated by the map javascript.</p>
  
  <pre><code>&lt;input type="text" class="extent-i vertical-align-center" readonly id="xmin-h" /&gt;
  &lt;input type="text" class="extent-i" readonly id="ymin-h" /&gt;
  &lt;input type="text" class="extent-i vertical-align-center" readonly id="xmax-h" /&gt;
  &lt;input type="text" class="extent-i" readonly id="ymax-h" /&gt;
  &lt;input type="text" class="extent-i" readonly id="wkid-h" /&gt;
  &lt;input type="hidden" id="json-h" /&gt;
  </code></pre>
  
  <p>These corespond to the XMIN, YMIN, XMAX, YMAX, WKID (Spatial Reference), and the json is an object that contains all of the above. </p>
  
  <p>Using JQUERY and MutationObserver I am able to detect these changes. I then send them to the controller using ajax.</p>
  
  <pre><code>function sendExtent(xmin,ymin,xmax,ymax,wkid){
  var data = {
      XMIN: xmin,
      YMIN: ymin,
      XMAX: xmax,
      YMAX: ymax,
      WKID: wkid
  
  }
  
  $.ajax({
     url: '@Url.Action("Index","Home")',
     data: data
  });
  
  var extentJson = $("#json-h").val();
  var json = JSON.parse(extentJson);
  
       XMIN = json["XMIN"];
       YMIN = json["YMIN"];
       XMAX = json["XMAX"];
       YMAX = json["YMAX"];
       WKID = json["WKID"];
    }
  
    sendExtent(XMIN, YMIN, XMAX, YMAX, WKID);
  </code></pre>
  
  <p>Controller is as follows:</p>
  
  <pre><code>  public ViewResult Index(string sortOrder, string currentFilter, string searchString, int? page, double? XMIN, double? YMIN, double? XMAX, double? YMAX, int? WKID, int? AGMT_NUM, string DisplayAs)
          {
              ViewBag.DisplayAs = DisplayAs;
              ViewBag.XMIN = XMIN;
              ViewBag.YMIN = YMIN;
              ViewBag.XMAX = XMAX;
              ViewBag.YMAX = YMAX;
              ViewBag.WKID = WKID;
              (...)
              (...)
              // some logic to manipulate data based sortOrder etc...
  
  
              int pageSize = 10;
              int pageNumber = (page ?? 1);
              return View(agreements.ToPagedList(pageNumber, pageSize));
  </code></pre>
  
  <p>The ajax call does not reload the page however though it does execute and i can confirm the values pass successfully. Do to the nature of the dynamic map, i do not want the view to reload every time, thus this behavior is good. </p>
  
  <p>What i need is to some how manage these extent changes so that when the view is refreshed or rendered, for example, when a table gets sorted or paged, the extent parameters will post to the url similiar to <code>blah blah/?blah blah &amp;XMIN=1234&amp;YMIN=5678.....etc...</code></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here is an example of a user action that causes the page to be re-rendered. It is triggered when a user selects something from a drop down.</p>
  
  <pre><code>/button&gt;
  &lt;ul class="dropdown-menu" id="display-as-ul"&gt;
      &lt;li&gt;@Html.ActionLink("Agreement Type", "Index", new {DisplayAs = "Type", page = ViewBag.Page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })&lt;/li&gt;
      &lt;li&gt;@Html.ActionLink("Leese Expiration", "Index", new {DisplayAs="Expiration", page = ViewBag.Page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter})&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>This passes the appropriate parameters to the controller which then reloads the page. As seen above the "DisplayAs" parameter is then stored in the URL. Similiar to what i am trying to do with the extent, the map is smart enough to pull that parameter from the url and manipulate what is displayed. </p>
  
  <p>This works here because the workflow goes from VIEW -> CONTROLLER -> VIEW(w/URL) -> EMBEDED MAP..</p>
  
  <p>This is different from the extent problem in two ways:
      1) The page does not need to render everytime the extent changes, the params only need to post when something else causes the page to render/reload.
      2) Workflow is as follows: EMBEDED MAP -> VIEW -> ????????</p>
  
  <p>If this is way off please tell me what you would do</p>