'Posting and retrieving URL params with Razor MVC

I am trying to mark a checkbox then reload the page to load the page with a marked checkbox. I am using this code for my checkbox:

@Html.CheckBoxFor(model => controller.ShowAll, htmlAttributes: new { @onclick = "this.form.submit();" })

In my model I have this property that I want to send in URL params:

public bool ShowAll { get; set; }

By having it public I think it is seen in the URL params but it is not sending the updated value. This is the Request.Params I get when I reload the page with the submit shown above:

{controller.ShowAll=true&controller.ShowAll=false}

paramValue will get the value of "true,false" so both when retrieving it like below:

string paramValue = Request.Params["controller.ShowAll"];


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source