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

  • SEARCH
  • Home
  • 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 6764227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:34:09+00:00 2026-05-26T14:34:09+00:00

I have a problem in my application I am using MVC 3 with razor

  • 0

I have a problem in my application
I am using MVC 3 with razor and i want to get the value of checked box in the form

@using (Html.BeginForm("ConfirmItemAvilabilty", "Order", FormMethod.Post, new { id = "frmConfirmAvilabilty", name = "frmConfirmAvilability" }))
{
    foreach (OrderItem orderItem in orderAction.Order.OrderItems)
    {
    <div class="product">
        <ul>
            <li>
                <div class="productImg">
                    <img src="@orderItem.Product.Image" width="100px" height="100px"/>
                </div>
                <div class="centered">
                    <a href="@orderItem.Product.Link" target="_blank">Link</a> <span>@orderItem.Product.TitleAr</span>
                    <span>@orderItem.Product.Price</span>
                </div>
                @if (currentUser.UserTypeEnum == UserTypeEnum.Reseller)
                {
                    <div>
                        @Html.CheckBox("ChkConfirm", orderItem.IsAvailable, new { id="chkConfirm" ,@class="chkConfirm"})
                        @Html.Hidden("OrderItemId", orderItem.Id, new { id="hdnConfirm"})
                    </div>
                }
            </li>
        </ul>
    </div>
    }
    if (currentUser.UserTypeEnum == UserTypeEnum.Reseller)
    { 
        <button>Confirm</button>
    }
}

Simply i want to get the value of all checked checkboxs i tryed to create a model holding the value of my checkbox and the value of the hidden text below it

public class ItemOrderModel
{
    public string ChkConfirm { get; set; }
    public string OrderItemId { get; set; }
}

and in my controller i do the following but nothing happened

   public ActionResult ConfirmItemAvilabilty(List<ItemOrderModel> OrderItems)
    {

        return View();
    }

but orderItems always returns null, Can anyone help me in that?

—————– Edit ——————
Thank you Sam and Jesse

I Found a solution for my problem but I am facing another problem now first of all i solved my problem by changing in model view to be like that

public class ItemOrderModel
{
    public List<bool> ChkConfirms { get; set; }
    public List<string> OrderItemId { get; set; }
}

and change the checkbox name to be

  @Html.CheckBox("ChkConfirms", orderItem.IsAvailable, new { id = "chkConfirm", @class = "chkConfirm" })

the problem now is
when i submit i found two values false that is the actual representation of my checkboxs and two ids that’s also the actual representation of my hidden fields “Correct scenario”
when i check one of check boxs in the same form i found 3 result for the check box and 2 results for the hidden field Can any one help in that or have a solution

  • 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-26T14:34:09+00:00Added an answer on May 26, 2026 at 2:34 pm

    You need to look into Editor Templates:

    How to create custom editor/display templates in ASP.NET MVC 3?

    These allow you to do the exact thing you are talking about.

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

Sidebar

Related Questions

We have a large legacy application where we want to start using MVC for
I have created a sample project using ASP.NET MVC 3 Web Application (Razor) template.
I have problem concerning python packages and testing. I'm writing an application using wx
Here's the core problem: I have a .NET application that is using COM interop
I have a problem with a memory leak in a .NET CF application. Using
I'm using Rational Application Developer to create some web services. The problem I have
I am using a javax.servlet.http.HttpServletRequest to implement a web application. I have no problem
I have a following problem: I compiled my application on Linux Ubuntu 9.10 using
I am having a problem using the Unity Application Block, I have created a
I'm trying to make this 2-player web game application using Spring MVC. I have

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.