Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:45:06+00:00 2026-05-27T20:45:06+00:00

I have a form in my asp.net mvc view as follow: <%using (Html.BeginForm(SearchBorrowed, Admin,

  • 0

I have a form in my asp.net mvc view as follow:

 <%using (Html.BeginForm("SearchBorrowed", "Admin", FormMethod.Get))
          { %>
        <%: Html.TextBox("searchTerm", Request.QueryString["searchterm"])%>
        <input type="submit" value="Search" />
        <br />
        Is Returned :
        <%:Html.CheckBox("IsReturned")%>
        <%} %>

and here is the ‘SearchBorrowed’ action:

public ActionResult SearchBorrowed(bool IsReturned=false, string searchTerm = null)
        {
            IEnumerable<BorrwoinfInfo> bs;

            //...Get from repository

            return View(bs.ToList());

        }

and finally routing settings :

  routes.MapRoute(
            "SearchBorrowed", // Route name
            "{controller}/{action}/{*searchTerm}", // URL with parameters
            new
            {
                controller = "Admin",
                action = "SearchBorrowed",

                searchTerm = UrlParameter.Optional
            } // Parameter defaults

when I submit the form without checking ‘IsReturned’ Checkbox,
it returns result and the url gets as follow :

…/SearchBorrowed?searchterm=&IsReturned=false

But when I check IsReturned’ Checkbox, the urls gets like this:

…/SearchBorrowed?searchterm=s&IsReturned=true&IsReturned=false

Why there is two IsReturned in above url ?!

How Could I fix this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:45:07+00:00Added an answer on May 27, 2026 at 8:45 pm

    Why there is two IsReturned in above url ?!

    Because the Html.CheckBox helper generates an additional hidden input field with the same name as the checkbox. If you look at the generated HTML you will see that the helper generated the following 2 input fields:

    <input type="checkbox" name="IsReturned" id="IsReturned" value="true" checked="checked" />
    <input type="hidden" name="IsReturned" id="IsReturned" value="false" />
    

    This is by design. This helper is intended to be bound to a boolean property on your view model. When a checkbox field is not checked no value is sent to the server, so if there was not no hidden field you wouldn’t be able to bind it to a boolean field.

    If you don’t want this hidden field you could either write a custom helper or generate the checkbox field manually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you have an ASP.Net MVC form created by Html.BeginForm(), how do fields inside
I am using ASP.Net MVC. I have a partial view which has a form
i have an html table inside a form in an asp.net mvc view. I
Greetings! I'm doing a Form on ASP.NET MVC 2, in my view I have
I have a form that collects a data using ASP.NET MVC. It looks like
I am using ASP.NET MVC 1.0. I have an ActionResult which receives a form
In my ASP.net MVC View I have a dropdown that I want to get
i have a regular html Grid and i am binding my asp.net mvc view
Using ASP.Net MVC 1.0 I have a form with some input control on it.
Inside of an asp.net mvc partial view, I have an Ajax form that posts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.