Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
CheckBoxFor value is always FALSE HTML /ASP.NET

I want to display 2 fields one is checkbox and the another one is description in the case of the checkbox for some reason always is coming FALSE using CheckBoxFor the description is coming fine!

HTML Code

<table>
    @for (var i = 0; i < Model.PurchaseOrder.LineItems.Count(); i++)
    {
        <tr>
            <td>           
                @Html.CheckBoxFor(m => m.LineItems[i].Received)
              
            </td>
            <td>
                @Model.PurchaseOrder.LineItems.ToArray()[i].Description 
            </td>         
        </tr>
    }
</table>

Model

public class LineItem 
{
    [MaxLength(2000)]
    public string Description { get; set; }

    public bool Received { get; set; }
}

Model

public class PurchaseOrder 
{
    [MaxLength(100)]
    public string AccountNumber { get; set; }

    public IEnumerable<LineItem> LineItems { get; set; } = new List<LineItem>();
}

ViewModel

public class ViewModel
{
    public PurchaseOrder PurchaseOrder { get; set; }

    public List<LineItem> LineItems { get; set; }
}

I need to know how could be the reason that is coming FALSE the CheckBoxFor Thanks!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!