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 6923293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:31:03+00:00 2026-05-27T10:31:03+00:00

My controller always gets null for the adjModel parameter. How can I retrieve the

  • 0

My controller always gets “null” for the “adjModel” parameter.
How can I retrieve the values?

CONTROLLER

[HttpPost]
public ActionResult AdjustmentList(List<AdjustmentVM> adjModel)
{
   // adjModel is null
}

VIEW

@model List<ExtFramework.ViewModels.BillingArea.AdjustmentVM>

<div class="no-fancybox">
@using (Html.BeginForm("AdjustmentList", "Deposit", new { depositId = ViewBag.depositId }))
{
    <div>
        <table id="adjustment">
            <tr>
                <th>Description</th>
                <th>Montant</th>
            </tr>
            @foreach(var item in Model)
            {
                <tr>
                    <td>@Html.TextBoxFor(model => item.Description)</td>
                    <td>@Html.TextBoxFor(model => item.Amount)</td>
                </tr>
            }
        </table>
        <input type="submit" value="" class="save" />
    </div>
}
</div>

MODEL

namespace ExtFramework.ViewModels.BillingArea
{
    public class AdjustmentVM
    {
        public int AdjustmentId { get; set; }
        public string Description { get; set; }
        public decimal Amount { get; set; }
        public int DepositId { get; set; }
    }
}
  • 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-27T10:31:03+00:00Added an answer on May 27, 2026 at 10:31 am

    This is where editor templates are useful. Instead of using a foreach loop to go through the list of view models, use @Html.EditorFor(m => m). Then, in a subfolder named EditorTemplates (an MVC naming convention) add a view with the name AdjustmentVM.cshtml. Again, this is another MVC naming convetion – using the name of the type being used. This file would look like:

    @model AdjustmentVM
    
    <tr>
        <td>@Html.TextBoxFor(model => model.Description)</td>
        <td>@Html.TextBoxFor(model => model.Amount)</td>
    </tr>
    

    The runtime will automatically loop over the items in the list and render the contents of the editor template, giving unique names for each form value, so that the default model binder can map these to the properties on the view model on postback.

    You can customise the name of the editor template if you want, look a the UIHintAttribute class.

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

Sidebar

Related Questions

What is wrong? Model is always null. Controller [HttpGet] public ViewResult Add() { return
I have controller which gets list of keys and i want to pass them
Right now it always goes to default.aspx that subsequently opens the default controller but
I'm using JQuery's getJSON method to retrieve some data from an MVC controller. [AcceptVerbs(HttpVerbs.Get)]
I'm recoding a splitview controller app I did so the table view isn't always
My Controller class is decorated with an AuthorizeAttribute to protect the actions: [Authorize(Roles =
My Controller Action accepts int id. What to do when calling from View ActionLink
My controller inherits UITableViewController : <UITableViewDelegate,UITableViewDataSource> The cells of the table are custom and
My controller, in a nutshell is this: chart1.SeriesCollection.Add(SC); using (MemoryStream ms = chart1.GetChartStream()) {
In controller level i used [ValidateInput(false)] and ValidateRequest=false in the view. Everything is fine

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.