title: Dynamic Actionlinks
body: <p>I am using asp.net mvc 4 and I have the following scenario</p>
  
  <pre><code>Cities           Places     Events
  ------           ------------------
  City 1          |                  
  City 2          |
                  |
  </code></pre>
  
  <p>The left navigation (cities) list all of the cities in database. Places and Events also are links to action methods.</p>
  
  <pre><code>&lt;li&gt;@Html.ActionLink("Places", "Places", null, new{id="placeslink"})&lt;/li&gt;
  &lt;li&gt;@Html.ActionLink("Events", "Events", null, new{id="eventslink"})&lt;/li&gt;
  </code></pre>
  
  <p>I am asynchronously loading Places and Events using the following script (jQuery)</p>
  
  <pre><code>$('#placeslink').click(function (event) {
      event.preventDefault();
  
      var url = $(this).attr('href');
      $('#content').html(ajax_load).load(url);
  });
  
  $('#eventslink').click(function (event) {
      event.preventDefault();
  
      var url = $(this).attr('href');
      $('#content').html(ajax_load).load(url);
  });
  </code></pre>
  
  <p>Its is working fine and populates all the places (not city specific) and Events on the page from database when Places and Events links are clicked.</p>
  
  <p>Now what I want to achieve is that when user click a city while viewing places, only the places in that city are displayed and if events are selected, the same city link should display the events in that city.
  Similary if a city (e.g City 1) is selected and user click places, places in the selected city are displayed and if she clicks Events, events for the selected city are display.</p>
  
  <p>I have the following action methods </p>
  
  <pre><code>public ActionResult Places()
  {
    if (Request.IsAjaxRequest())
    {
       ....  
       return PartialView(model);               
  
    }
    return View();
  }
  </code></pre>
  
  <p>Its quite confusing and I cannot think of a single way how to generate appropriate links for City, places and events and achieve the above mentioned results.</p>