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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:19:02+00:00 2026-05-29T11:19:02+00:00

I use entity Framework 4.2 and MVC 4 I Got this model/Database structure UserInformation

  • 0

I use entity Framework 4.2 and MVC 4

I Got this model/Database structure

UserInformation
UserID(PK)
FirstName
LastName
Email

UserFavoriteColor
FavID(PK)
Color
Why
UserID(FK)

Is it possible in one Create Controller Action to fill the UserInformation table and then Fill the UserFavoriteColor.

I Know I could perform this in two steps by creating 2 separates sectiosn. But this is not what I want.

enter image description here

  • 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-29T11:19:03+00:00Added an answer on May 29, 2026 at 11:19 am

    Typically, you would use jQuery to insert a new row. Since we don’t know what your code looks like, it’s hard to show you exactly how this should be done, but you can look at the examples here:

    http://ivanz.com/2011/06/16/editing-variable-length-reorderable-collections-in-asp-net-mvc-part-1/

    The trick is that you have to name them appropriately so that the model binder will add them to your collection when you click save. Then you have to write code in your post method to walk through the list of colors and add any records that don’t exist already.

    This is a relatively complex thing, so it’s not something that can be easily covered in a single answer here.

    Another option is to simply have an action for the add-new button, and this inserts a blank record into the data collection, which on postback will now get 3 records (one of them with null values). When you fill in the values, it will then postback to the main post method and udate the blank record.

    This solution has the drawback that if the user adds a new record and doesn’t save, the blank record stays in the database.

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

Sidebar

Related Questions

For my ASP.NET MVC 2 application I use Entity Framework 1.0 as my data
How do I use Datatable instead of Entity framework in Asp.Net mvc? I'm referring
Is it possible to use Microsoft Entity Framework with Oracle database?
I use Entity Framework 4 and MVC 2. I Have an Address Entity, Contact,
I am trying use MySql and Entity Framework, using Connector/Net 6.1 with this as
I have a small MVC 3 app using Entity Framework Code First and use
Are there any open-source examples of ASP.NET MVC applications that use the Entity Framework?
I've tried to use Entity Framework 4 and POCO for my MVC 3 project.
I want to use MVC 3 and the Entity Framework for my application. The
I'm trying to use the Entity Framework code first without an existing database. I

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.