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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:52:53+00:00 2026-06-09T04:52:53+00:00

This is a follow up to MVC3 form in partial view Although the author

  • 0

This is a follow up to MVC3 form in partial view

Although the author gave a workaround to the problem. I would like to find out a proper answer why this is not working.

I don’t have access to original code, but here’s mine (so I can answer following questions):

// main view (which is partial too)
    @foreach (AddingComponentVM sc in Model)
    {
        @Html.Partial("_SearchIngredientUpdate", sc);     
    }

//partial view
@using (Ajax.BeginForm("IngredientSearchUpdate", new { controller = "Recipe" }, ajxOpt, new { id = "addingWidgetForm" + Model.IngredientID }))
    {           
        @Html.TextBoxFor(model => model.IngredientID)
        @Model.IngredientID
    }

@Model.IngredientID contains proper value. But the textbox contains value of the model sent to controller (sic!) and it is obviously the same for each form.

[AjaxOnly]
public JsonResult IngredientSearchUpdate(
    AddingComponentVM dataIn,
    [ModelBinder(typeof(SearchOptionsBinder))] SearchOptions sessionSO)

If action without AddingComponentVM in signature calls the same code above, forms renders correctly.

public PartialViewResult IngredientSearch([ModelBinder(typeof(SearchOptionsBinder))] SearchOptions sessionSO)

Anyone could point me out to the cause of this strange (at least for me) behaviour? 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-06-09T04:52:54+00:00Added an answer on June 9, 2026 at 4:52 am

    I couldn’t sleep because of this, but here’s the answer:

    It does not matter whether you use PartialView or EditorTemplates. As described here: How to modify posted form data within controller action before sending to view?

    “HTML Helpers uses the following order precedence when attempting lookup of the key:

    1. ViewData.ModelState dictionary entry
    2. Model property (if a strongly
      typed view. This property is a shortcut to View.ViewData.Model)
    3. ViewData dictionary entry”

    So if any values were posted it is enough to clear StateModel collection and then the data from model can be pick up by html helper used. This will do the trick:

    ModelState.Clear()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a follow up to this: What does MVC3 do with C# Optional
Trying to follow this example. (Section String sorting...) Is there anything obvious that would
This is a follow-up to: Getting Started With ASP.NET MVC3 & Google Checkout: Take
I'm working on a rather large Asp.net MVC3 project and would like to use
I'm using MVC3 and I would like to make my views be fully integrated
I am teaching myself asp .net mvc3. I have a partial view which uses
I have this follow code in my javascript. I call this function when the
I follow this tutorial online exactly but somehow it's giving me errors. Saying there
I follow this rule but some of my colleagues disagree with it and argue
I just follow this DIHQuickStart , try to import data to solr from mysql.

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.