title: asp.net mvc getting id from url
body: <p>ok i have a create/Index/23 view . the create method in the index controller is getting the value of the id when the dropdown event is triggered in the grid. no problem</p>
  
  <p>but there is the search option in my page as well which has ajax.beginform as well. 
  clicking the button there and calling the search method in the index controller is not having the id value which is present in the url . how would i get the id value in the controller . i hope that the question is clear.</p>
  
  <p>Edit: this is the code snippet down here , clicking the button down here will trigger the Search method in the Controller ( which is not getting the id value )</p>
  
  <p>Create.aspx</p>
  
  <pre><code>   &lt;% using (Ajax.BeginForm("Search", new AjaxOptions { UpdateTargetId = "divGrid", OnComplete = "OnComp" }))     {%&gt;
  
  &lt;%:  Html.DropDownList("SelectedsItem", JobHelper.JobSelectStatusDropDown() as IEnumerable&lt;SelectListItem&gt;)%&gt;
  &lt;input type="submit" value="Search" /&gt;
  </code></pre>
  
  <p>&lt;% } %> </p>
  
  <pre><code> &lt;% if (Model.Count() &gt; 0)
   { %&gt;
   &lt;div id="divGrid"&gt; 
      &lt;% Html.RenderPartial("Manage", this.Model);  %&gt;
   &lt;/div&gt;
     &lt;% } %&gt;
  </code></pre>
  
  <p>Solved using the global.asax</p>