http - Why are my querystring parameters being doubled up in the post body of my ASP.NET MVC 4 Application? -


here relevant bits of my

viewmodel:

    [display(name = "one per line")]     public bool oneperline { get; set; }      [display(name = "comma separated")]     public bool commaseparated { get; set; }      [display(name="upper case")]     public bool uppercase { get; set; } 

view:

                    @using (html.beginform("index", "home", formmethod.post, new { @class = "form-horizontal" }))                 {                     .                      .                     <div class="control-group">                         @html.labelfor(m => m.oneperline, "one per line?", new dictionary<string, object> { { "class", "control-label" } })                         <div class="controls">                             @html.checkboxfor(m => m.oneperline)                         </div>                     </div>                     <div class="control-group">                         @html.labelfor(m => m.commaseparated, "comma separate them?", new dictionary<string, object> { { "class", "control-label" } })                         <div class="controls">                             @html.checkboxfor(m => m.commaseparated)                         </div>                     </div>                     <div class="control-group">                         @html.labelfor(m => m.uppercase, "uppercase?", new dictionary<string, object> { { "class", "control-label" } })                         <div class="controls">                             @html.checkboxfor(m => m.uppercase)                         </div>                     </div>                     .                     .                 } 

and here's see in fiddler during post:

oneperline=true&oneperline=false&commaseparated=true&commaseparated=false&uppercase=true&uppercase=false 

when gets controller viewmodel has correct values view, find doubling odd in post body.

dug around more , found answer here.

turns out html.checkbox helper renders addition hidden input address scenarios unchecked checkboxes not sent in request.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -