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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:07:16+00:00 2026-05-25T00:07:16+00:00

Im creating an application that allows me to record recipes. Im trying to create

  • 0

Im creating an application that allows me to record recipes. Im trying to create a view that allows me to add the basics of a recipe e.g. recipe name,date of recipe, temp cooked at & ingredients used.

I am creating a view that contains some jquery to load a partial view clientside.

On post im having a few troubles trying to get the values from the partial view that has been loaded using jquery.

A cut down version of my main view looks like (I initially want 1 partial view loaded)

 <div id="ingredients">
         @{ Html.RenderPartial("_AddIngredient", new IngredientViewModel()); }
    </div>
    <script type="text/javascript">
    $(document).ready(function () {
    var dest = $("#ingredients");
    $("#add-ingredient").click(function () {
        loadPartial();
    });
    function loadPartial() {
        $.get("/Recipe/AddIngredient", {}, function (data) { $('#ingredients').append(data); }, "html");
    };
});
</script>

My partial view looks like

<div class="ingredient-name">
   @Html.LabelFor(x => Model.IngredientModel.IngredientName)
   @Html.TextBoxFor(x => Model.IngredientModel.IngredientName)
</div>
<div class="ingredient-measurementamount">
   @Html.LabelFor(x => Model.MeasurementAmount)
   @Html.TextBoxFor(x => Model.MeasurementAmount)
</div>
<div class="ingredient-measurementtype">
  @Html.LabelFor(x => Model.MeasurementType)
  @Html.TextBoxFor(x => Model.MeasurementType)
</div>

Controller Post

  [HttpPost]
    public ActionResult Create(RecipeViewModel vm,IEnumerable<string>IngredientName,  IEnumerable<string> MeasurementAmount, IEnumerable<string> MeasurementType)
    {

Finally my viewmodel looks like

 public class IngredientViewModel
{
    public RecipeModel RecipeModel { get; set; }
    public IEnumerable<IngredientModel> Ingredients { get; set; }

}

My controller is pretty ugly……im using Inumerble to get the values for MeasurementAmount & MeasurementType (IngredientName always returns null), Ideally I thought on the httppost Ingredients would be populated with all of the on I would be able Ingredients populated

What do I need to do to get the values from my partial view into my controller?

  • 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-25T00:07:16+00:00Added an answer on May 25, 2026 at 12:07 am

    Why don’t you take a look at the MVC Controlstoolkit

    I think they would do what you want.

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

Sidebar

Related Questions

I am creating an ASP.NET application that allows the user to add form elements
I'm trying to design an interface for a web-based application that allows the user
In codeigniter I am creating an application that allows the user to upload multiple
I'm creating an application (Windows Form) that allows the user to take a screenshot
I'm creating an application in Qt that allows users to drag around various modules
I am creating an ASP.NET application that allows users to edit and insert data
I'm currently creating an application for a customer that will allow them to automatically
I'm creating an application that will store a hierarchical collection of items in an
I am creating an application that manages multiple instances of an external utility, supplying
We are creating an XBAP application that we need to have rounded corners in

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.