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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:41:44+00:00 2026-05-31T08:41:44+00:00

I’m developing MVC application and I have following classes in my model: public class

  • 0

I’m developing MVC application and I have following classes in my model:

public class Member 
{
    [Required]
    public string Name {get;set;}
    public virtual ICollection AgeBrackets{ get;set;}
}

public class AgeBracket
{
    [Required]
    public int MinAge {get;set;}

    [Required]
    public int MaxAge {get;set;}
    
    public virtual Member Member {get;set;}
}

In Create/Edit view for Member I would like to have kind of parent-child view: common edit-fields (Name) for Member and partial view for collection of AgeBrackets associated with the Member. I want to be able to add/edit/delete AgeBrackets using jQueryUI Dialog form and update list of agebrackets on client.

The question is – where should I store collection of brackets?

I don’t want to post any changes to collection of brackets to the server until whole Member form posted.

I was trying to accomplish it using knockout.js. It seems like most elegant way of doing it. Is it possible to use knockout.js only for collection of AgeBrackets and keep Member binding to MVC model binding and during Member post somehow combine Member-fields and knockout AgeBracket collection viewmodel?

  • 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-31T08:41:45+00:00Added an answer on May 31, 2026 at 8:41 am

    When working with KO i find it much easier to work with pure json both as input and output from your action methods.

    It makes things lot easier if you client-side model is as close to your server-side as possible. How you populate this model is up to you (manually code, map using the mapping plugin etc). Assuming your client side model for a Member looks like

    var memberViewModel = function() {
        this.name = ko.observable("Alex");
        this.ageBrackets = ko.observableArray([
            { minAge: 15, maxAge: 20 },
            { minAge: 18, maxAge: 21 },
        ]);
    };
    

    Then your action method can be

    public JsonResult Create(Member member) {
        ....
    }
    

    When you hit the create button your a function fire that converts your memberViewModel into JSON which will be posted back and mapped automatically to your Member model.

    To convert to JSON you can use ko.toJSON(memberViewModel) or ko.mapping.toJSON(memberViewModel) if you used the mapping plugin initially.

    Hope this helps.

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

Sidebar

Related Questions

For the web application (ASP.NET MVC) I'm currently developing, we have the following architecture
I have been developing an asp.net mvc application where i need to make large
I am developing an application using MVC Preview 5. I have used typed views.
I am developing an application in asp.net mvc where i need to have Chat
Hi I am developing a simple application based upon ASP.NET MVC. I have altered
I'm developing Asp.MVc 2 application. In solution i've about 10 projects and i have
I'm trying to write some tests for an MVC application we're developing. We have
I have an ASP.NET MVC application that I'm working on. I've been developing it
Developing an MVC application, i now need to have test other browser versions. Installed
I am developing StudentApp in .NET 3.5 SP1 MVC Application. I have two tables

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.