have implemented filtering on my ASP.NET MVC 5 app. My searchbox consists of a few Dropdownlists with predefined values. When the Dropdownlist value changes, the form is submitted and I see all available tickets for a specific method.
After the form submits the page reloads and I see the url like mysite.com/?Method=car
. But I would like to get rid of the query string and put car directly into the url, i.e.
mysite.com/method/car
or mysite.com/method/plain
etc
Is it possible?
Search box
@using (Html.BeginForm("Search", "Transfer", FormMethod.Get))
{
<div class="form-horizontal">
<div class="form-group">
<div class="col-md-10">
@Html.DropDownListFor(model => model.Method, Model.Methods, new { @class = "query"})
</div>
</div>
</div>
<input type="submit" class="hidden" />
}
My action method
[Route("~/transfer/{method?}")]
public async Task<ActionResult> List(string method)
{
//filter and displaying
return View(viewModel);
}