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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:32:28+00:00 2026-06-02T09:32:28+00:00

My SomeModel is defined as: public class SomeModel { public string property1 { get;

  • 0

My SomeModel is defined as:

public class SomeModel
{
   public string property1 { get; set }
   public bool property2 { get; set; }
}

I have an action:

public ActionResult Edit(int id)
{
    SomeModel model = new SomeModel();
    //... populate model ...
    return View(model);
}

Assume that in the view property1 and property2 are instanced as @Html.EditorFor, in which case property1 would be rendered as a <input type='text'> and property2 would be a <input type='checkbox'>.

If I have the following controller action to handle a submit from the Edit form:

[HttpPost]
public ActionResult Edit(int id, SomeModel model, FormCollection collection)
{
}

How does the parameter model get populated, if ever?

  • 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-06-02T09:32:30+00:00Added an answer on June 2, 2026 at 9:32 am

    If you use something like

    [HttpPost]
    public ActionResult Action(SomeModel model)
    {
        //do something
    }
    

    All the model binding will be taken care of for you if you use the standard Html.EditorFor syntax in your view, as you have alluded to.

    @Html.EditorFor(model => model.Property1)
    @Html.EditorFor(model => model.Property2)
    

    More on Model Binding here

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

Sidebar

Related Questions

class SomeModel { [Display(Name = Quantity Required)] public int Qty { get; set; }
On server I have the following class public class A { string a1 {get;
Given the following types public class SomeValue { public int Id { get; set;
Let's say I have a setup like this: public ActionResult Create(int someUnrelatedNumber) { ...
Lets say I have something like this: public ActionResult Test(SomeModel m) { try {
I have a model containing ImageField which should be resized after uploading. class SomeModel(models.Model):
I used to receive empty string when there was no value: [HttpPost] public ActionResult
I have a controller POST action that redirects to a GET method using RedirectToAction.
Having defined a Model public class HomeModel { [Required] [Display(Name = First Name)] public
I have a model with a m2m relation to users: class SomeModel(models.Model): user=models.ManyToManyField(User,related_name='linked',blank=True,null=True) to

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.