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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:37:40+00:00 2026-05-20T10:37:40+00:00

I have several forms, all which require a checkbox for each province/state. Therefore, I’ve

  • 0

I have several forms, all which require a checkbox for each province/state. Therefore, I’ve made a partial view to render the checkboxes inside a form to promote code re-use. But when the user submits the form to a controller method, the RegionsViewModel does not get binded. The overall question is, how can I get multiple forms to share a partial view and view model?

Here’s a sample code of my situation
Models

public class Form1ViewModel
{
    /* Some properties */
    public RegionsViewModel Regions {set; get;}
}

public class Form2ViewModel
{
    /* Some properties */
    public RegionsViewModel Regions {set; get;}
}

public class Form3ViewModel
{
    /* Some properties */
    public RegionsViewModel Regions {set; get;}
}

public class RegionsViewModel
{
    public bool ON {set; get;}
    public bool QC {set; get;}
    /* this continues for all provinces and states */
}

Controller

[HttpPost]
public ActionResult Form(Form1VewModel model) {

    //All properties except for model.RegionViewModel does not bind properly to the submitted form :(
}

Form1ViewModel.aspx

<% using (Html.BeginForm())
    {%>
    <!-- Binds some property -->
    <% Html.RenderPartial("Controls/RegionSelector", Model.Regions); %>
    <input type="submit" value="Submit Form!" />
<%}%>

Controls/RegionSelector.ascx

<%=Html.CheckBoxFor(x => x.AvailableProvince_ON> ON
<%=Html.CheckBoxFor(x => x.AvailableProvince_QC> QC
<!-- Binds to all provinces and states -->

Update
Replaced “Model.RegionSelectorVm” with “Model.Region”. Thanks for finding the bug in my demo code Darin Dimitrov.

  • 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-20T10:37:41+00:00Added an answer on May 20, 2026 at 10:37 am

    What is RegionSelectorVm? It seems that this is the type of your partial. Try with editor templates. It’s cleaner:

    <% using (Html.BeginForm()) { %>
        <!-- Binds some property -->
        <%= Html.EditorFor(x => x.Regions) %>
        <input type="submit" value="Submit Form!" />
    <% } %>
    

    and inside ~/Views/Shared/EditorTemplates/RegionsViewModel.ascx:

    <%@ Control 
        Language="C#" 
        Inherits="System.Web.Mvc.ViewUserControl<AppName.Models.RegionsViewModel>" %>
    <%= Html.CheckBoxFor(x => x.ON) %> ON
    <%= Html.CheckBoxFor(x => x.QC) %> QC
    
    <!-- 
         Continue with inputs for the provinces and states 
         which are part of the RegionsViewModel model 
    -->
    

    Now everything should bind correctly.

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

Sidebar

Related Questions

An easy jQuery question. I have several identical forms ( except their name )
I have several .NET Windows Forms applications that I'm preparing to convert into a
VB 2008. I have several text boxes on a form and I want each
I have several input and option elements on my page, each (well almost) have
I have a web form which is split up into several HTML pages. I
I have an Access 2003 project in which all data is stored in SQL
We have several wizard style form applications on our website where we capture information
I have several ASP:TextBox controls on a form (about 20). When the form loads,
I have several user drawn controls on a form, unfortunately when the form is
I have several strings in the rough form: [some text] [some number] [some more

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.