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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:30:48+00:00 2026-05-19T09:30:48+00:00

I am trying to update model from the FormCollection for two distinct collections of

  • 0

I am trying to update model from the FormCollection for two distinct collections of model. IT only works for the first time. Here is the sample code:

        public ActionResult Edit(int id, FormCollection form)
    {
        Order ord = pr.GetOrder(id);
        TryUpdateModel<Order>(ord, form.ToValueProvider());

        IEnumerable<OrderItem> items = new List<OrderItem>();
        IEnumerable<OrderPayment> pmts = new List<OrderPayment>();
        /* 1. */ TryUpdateModel<IEnumerable<OrderItem>>(items, "oitm", form.ToValueProvider());
        /* 2. */ TryUpdateModel<IEnumerable<OrderPayment>>(pmts, "opmt", form.ToValueProvider());
        //Save the model 
        return PartialView("IndexItem", inv);
    }

It populates the model for Order and items, but does not update pmts collection from formcollection. I checked the form collection and it does have all the properties for the opmt prefix. If I switch the TryUpdateModel between 1 and 2 then it updates the pmts successfully and not the items.
My assumptions are as follows:

  1. It may be something to do with multiple TryUpdateModel on a collection.
  2. Once I get the ModelState Error then it will not update following try to update model

What am I doing wrong here???

THIS SAME CODE and MODELS were WORKING FOR MVC2!

Thanks

  • 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-19T09:30:49+00:00Added an answer on May 19, 2026 at 9:30 am

    GREAT!

    RTM release of MVC3 has fixed this issue. So looks like it was bug but no one acknowledged it. Anyways its fixed.

    Great release, Thanks to MVC team.

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

Sidebar

Related Questions

I am trying to modify model coming from View and then update my database
I trying to update a model on a callback but the validation is causing
Am trying to construct a simple update query in my model class Model_DbTable_Account extends
I am trying to update a field in a table with data from another
I am trying to update several products that are fed from an XML file
I have tried to implement this scenario . I have created Code First model,
I'm trying to write a compact update controller for CRUD activity. Here is the
I have a problem trying to update an attribute of one model using the
I have strange situation - when I'm trying to update model, that can contains
I'm trying to update some rows in a table based on two other columns

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.