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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:40:56+00:00 2026-05-23T13:40:56+00:00

public class FileSubmissionModel { public List<DraftFile> ValidFiles{ get ; set ; } public List<DraftFile>

  • 0
public class FileSubmissionModel
{
    public List<DraftFile> ValidFiles{ get ; set ;  }
    public List<DraftFile> InvalidFiles{ get ; set ;  }
}

Where:

public class DraftFile
{

    public Guid DraftId { get ; set ;  }
    public string OriginalFileName { get ; set ;  }
}

Gives a null on:

[HttpPost]
public ActionResult Step2(FileSubmissionModel validFiles)
{
 ...
}

The parameter ‘validFiles.ValidFiles’ & ‘validFiles.InvalidFiles’ are returned as null. Does anyone know why and what I can do to correct this?
Cheers,
Pete

View code as asked for…I’ve snipped some out but you get the gist:

@foreach (var item in Model.InvalidFiles)
        {
        count++;
        <tr>
            @Html.HiddenFor(model => model.InvalidFiles[count].DraftId) 
            @Html.HiddenFor(model => model.InvalidFiles[count].OriginalFileName ) 
        </tr>
        }
  • 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-23T13:40:57+00:00Added an answer on May 23, 2026 at 1:40 pm

    The problem seems to be that the parameter to the Step2 method validFiles is the same as the ValidFiles property on the FileSubmissionModel.

    Assuming that within the view you are doing something like:

    @for(var i = 0; i < 10; i++)
    {
     <p>  @Html.EditorFor(model => model.ValidFiles[i].DraftId)</p>
    }
    

    The name of the field will be generated as ValidFiles[0].DraftId which is what gets posted back to the server.

    The default model binder is trying to bind to the parameter rather than to the property on the model because the names are the same and the default model binder does a case insensitive match.

    My advice right now is to change the name of the parameter on your method.

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

Sidebar

Related Questions

public class Address { public string ZipCode {get; set;} } public class Customer {
public class InvestorMailing { public string To { get; set; } public IEnumerable<string> Attachments
public class Foo{ public string Prop1 {get;set;} public string Prop2 {get;set;} public Foo(Foo source)
public class Foo { public string Name { get; private set;} // <-- Because
public class MyWebControl { [ExternallyVisible] public string StyleString {get;set;} } public class SmarterWebControl :
public class Customer { public int CustomerId { get; set; } public string FirstName
public class Foo { public string Bar {get; set;} } How do I get
public class ClassA { public string MyString {get; set;} } public class ClassB {
public class Emp { public int ID { get; set; } public string Name
public class Abbreviation { public string ShortName { get; set; } public string LongName

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.