When i try the following structure, it does\'t send id=value
This behaviour is really annoying. One workaround is to drop the form completely and build your url by hand on the client side.
I used jQuery in one of our .NET projects to achieve this. It is a search mask with dozens of parameters. One of them is a range slider (min/max) values. You use the slider to select two values and have to press on the search button next to it.
@(Model.Unit)
to @(Model.Unit)
And the event handler for the button:
UrlHelper h = UrlHelperExtensions.CreateRequestAgnosticUrlHelper();
/* Search-Button Click-EventHandler */
$("#@(sliderButton)").click(function(){
@{
string url = h.Action("Index", "SearchAction", new RouteValueDictionary(searchParams));
string urlSeparator = url.Contains("?") ? "&" : "?";
}
var url = '@Html.Raw(url + urlSeparator + sliderInfo.AssociatedFieldName)=' + $("#@Html.Raw(sliderMinId)").val() + '%20-%20' + $("#@Html.Raw(sliderMaxId)").val();
window.location.replace(url);
});
This is what happens:
This is totally awkward for something that could be so simple... I hope this helps.