How to pass down values in a list to a Controller in C# after the values in the view are changed?How do you give a C# Auto-Property a default value?How do I clone a generic list in C#?How to get first N elements of a list in C#?How to loop through all enum values in C#?How do I convert an enum to a list in C#?C# how to create a Guid value?How to initialize a C# string list (List<string>) with many string valuesPass input values from view(aspx) to controllerHow to pass HiddenFor value from view to controllerPassing parameters from Controller to View in C#

Credit card details stolen every 1-2 years. What am I doing wrong?

Why don't commercial aircraft adopt a slightly more seaplane-like design to allow safer ditching in case of emergency?

How to color a tag in a math equation?

Should I be able to keep my company purchased standing desk when I leave my job?

A scene of Jimmy diversity

Which GPUs to get for Mathematical Optimization (if any...)?

''Habitable'' planet close to a star

Do dragons smell of lilacs?

Why is Google approaching my VPS machine?

What is this green alien supposed to be on the American covers?

what relax command means?

Kepler space telescope undetected planets

Why did Steve Rogers choose this character in Endgame?

Is it rude to refer to janitors as 'floor people'?

Wordplay subtraction paradox

Alphanumeric Line and Curve Counting

How could a medieval fortress manage large groups of migrants and travelers?

Did Voldemort kill his father before finding out about Horcruxes?

Operation Unz̖̬̜̺̬a͇͖̯͔͉l̟̭g͕̝̼͇͓̪͍o̬̝͍̹̻

What were the problems on the Apollo 11 lunar module?

Was Apollo 13 radio blackout on reentry longer than expected?

Strategy to pay off revolving debt while building reserve savings fund?

What are the first usages of "thong" as a wearable item of clothing, both on the feet and on the waist?

Why does FFmpeg choose 10+20+20 ms instead of an even 16 ms for 60 fps GIF images?



How to pass down values in a list to a Controller in C# after the values in the view are changed?


How do you give a C# Auto-Property a default value?How do I clone a generic list in C#?How to get first N elements of a list in C#?How to loop through all enum values in C#?How do I convert an enum to a list in C#?C# how to create a Guid value?How to initialize a C# string list (List<string>) with many string valuesPass input values from view(aspx) to controllerHow to pass HiddenFor value from view to controllerPassing parameters from Controller to View in C#






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have a viewmodel which contains data and is loaded in my view. To show the data in the HTML, I used some @foreach loops.



Now the page contains values from the viewmodel. For example, if the viewmodel contains 10 items, all 10 items are loaded through @foreach loops in the html.



After evertyhing is loaded, my javascript code checks how many items there are and splits the items to 2 different containers if certain conditions are met.



To give more color to the sketch:



The items are deliverables. Each deliverable has an address where it need to be delivered to. These addresses will be marked as deliverypoints on the map. The map is 1 container. So for example if I have 10 items there will be 10 marks on the map. The javascript calculates the distance and travel time between these marks. If the total deliverytime exceed 8 hours (a workday) then it extracts some items from the total itempool untill the total deliverytime in that specific container is under the 8 hours. The remainder of the deliverables will be put in another map (container).



Question



How can I post these 2 newly made containers including the items to my controller?



So what I need is is something like this:



public ActionResult RetrieveContainerIncludingItems(List<ExampleModel> Containers)


This list should contain its items.



This is my View Code:



<div class="content-container map-outer">
<div class="head">Transport</div>
<div class="content">
<div class="date-container">
</div>
<div class="map-inner">
<div class="route-container">
<div class="route-header">
<div class="truck-container">
<span class="truck-number">1</span>
</div>
<div class="starting-time-container">Starttime: <span class="starting-time">8:00</span></div>
<div class="data-right">
<span class="vehicle-number">XR-VR-95</span>
<span class="driver-name">Eric Peterson</span>
</div>
</div>
<div class="route-inner">
<!------------------------------------------>
@var counter = 0;
@foreach (var item in Model.TransportPlannerModels)

counter++;
string status = (item.Status == "Deliver") ? "route-item drop-off" : "route-item pick-up";
<div class="@status">
<div class="item-header">
<div class="item-order-container">
<span class="item-order">@counter</span>
</div>
<div class="location-type-container">
<span class="location-type">@item.Status</span>
</div>
<div class="location-address-container">
@Html.HiddenFor(x => item.Firstname)
<span class="location-address">@item.Firstname @item.LastName - @item.StreetName @item.Housenumber , @item.ZipCode <br/> @item.City</span>
</div>
<div class="icon-container">
<span class="icon icon-plus">+</span>
<span class="icon icon-minus">-</span>
</div>
</div>
<div class="item-center">
<div class="technical-info">
<span class="lat"></span>
<span class="lng"></span>
<span class="place_id"></span>
</div>
<div class="info-container">
<div class="order-number-container center-option-container">
<span class="center-bold">Ordernumber</span>
<span class="center-colon">:</span>
<span class="center-data order-number">@counter</span>
</div>
<div class="name-container center-option-container">
<span class="center-bold">Name</span>
<span class="center-colon">:</span>
<span class="center-data name">@item.Firstname @item.LastName</span>
</div>
<div class="address-container center-option-container">
<span class="center-bold">Address</span>
<span class="center-colon">:</span>
<span class="center-data address">@item.StreetName @item.Housenumber, @item.ZipCode @item.City</span>
</div>
<div class="kilometers-container center-option-container">
<span class="center-bold">Amount<br />kilometers</span>
<span class="center-colon">:</span>
<span class="center-data kilometers">50 km</span>
</div>
<div class="products-container center-option-container">
<span class="center-bold">Products</span>
<span class="center-colon">:</span>
<span class="center-data products">
<ul>
@foreach (var product in item.ProductTitles)

<li>@product.Key x @product.Value</li>

</ul>
</span>
</div>
</div>
<div class="marker-container">
<span class="marker-outer">
<span class="marker-number">@counter</span>
</span>
</div>
</div>
<div class="item-bottom">
<div class="dots-container">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</div>
<div class="bottom-flex">
<p>
Estimated traveltime: <span class="calculated-time">39min</span> <span class="dash">-</span><br /> Afstand: <span class="calculated-kilometers">51,8km</span>
</p>
<p><span class="estimated-time"></span></p>
</div>
<!------------------------------------------>
</div>
</div>

</div>
<div class="total-container">
<p><span class="bold">Total Traveltime: </span><span class="total-time">5:30</span><span class="bold">Kilometers: </span><span class="total-km">262,8km</span></p>
</div>
</div>
<div id="mapContainer0" class="map-container"></div>
</div>
</div>
</div>









share|improve this question
























  • The javascript you describe looks like business logic that should be server side. Depending on your user base (if they are not totally trusted), you should consider doing that logic on the server.

    – bradbury9
    Mar 26 at 9:29











  • dont pay attention to the static values in the code. its just an example. Thanks for your answer :)

    – nymtes
    Mar 26 at 9:37











  • make your second container a partial view. use Action that will accept, for example a list of item ids to be moved to a second container and load it with Ajax. (if i correctly get your question)

    – Jury Golubev
    Mar 26 at 9:49

















1















I have a viewmodel which contains data and is loaded in my view. To show the data in the HTML, I used some @foreach loops.



Now the page contains values from the viewmodel. For example, if the viewmodel contains 10 items, all 10 items are loaded through @foreach loops in the html.



After evertyhing is loaded, my javascript code checks how many items there are and splits the items to 2 different containers if certain conditions are met.



To give more color to the sketch:



The items are deliverables. Each deliverable has an address where it need to be delivered to. These addresses will be marked as deliverypoints on the map. The map is 1 container. So for example if I have 10 items there will be 10 marks on the map. The javascript calculates the distance and travel time between these marks. If the total deliverytime exceed 8 hours (a workday) then it extracts some items from the total itempool untill the total deliverytime in that specific container is under the 8 hours. The remainder of the deliverables will be put in another map (container).



Question



How can I post these 2 newly made containers including the items to my controller?



So what I need is is something like this:



public ActionResult RetrieveContainerIncludingItems(List<ExampleModel> Containers)


This list should contain its items.



This is my View Code:



<div class="content-container map-outer">
<div class="head">Transport</div>
<div class="content">
<div class="date-container">
</div>
<div class="map-inner">
<div class="route-container">
<div class="route-header">
<div class="truck-container">
<span class="truck-number">1</span>
</div>
<div class="starting-time-container">Starttime: <span class="starting-time">8:00</span></div>
<div class="data-right">
<span class="vehicle-number">XR-VR-95</span>
<span class="driver-name">Eric Peterson</span>
</div>
</div>
<div class="route-inner">
<!------------------------------------------>
@var counter = 0;
@foreach (var item in Model.TransportPlannerModels)

counter++;
string status = (item.Status == "Deliver") ? "route-item drop-off" : "route-item pick-up";
<div class="@status">
<div class="item-header">
<div class="item-order-container">
<span class="item-order">@counter</span>
</div>
<div class="location-type-container">
<span class="location-type">@item.Status</span>
</div>
<div class="location-address-container">
@Html.HiddenFor(x => item.Firstname)
<span class="location-address">@item.Firstname @item.LastName - @item.StreetName @item.Housenumber , @item.ZipCode <br/> @item.City</span>
</div>
<div class="icon-container">
<span class="icon icon-plus">+</span>
<span class="icon icon-minus">-</span>
</div>
</div>
<div class="item-center">
<div class="technical-info">
<span class="lat"></span>
<span class="lng"></span>
<span class="place_id"></span>
</div>
<div class="info-container">
<div class="order-number-container center-option-container">
<span class="center-bold">Ordernumber</span>
<span class="center-colon">:</span>
<span class="center-data order-number">@counter</span>
</div>
<div class="name-container center-option-container">
<span class="center-bold">Name</span>
<span class="center-colon">:</span>
<span class="center-data name">@item.Firstname @item.LastName</span>
</div>
<div class="address-container center-option-container">
<span class="center-bold">Address</span>
<span class="center-colon">:</span>
<span class="center-data address">@item.StreetName @item.Housenumber, @item.ZipCode @item.City</span>
</div>
<div class="kilometers-container center-option-container">
<span class="center-bold">Amount<br />kilometers</span>
<span class="center-colon">:</span>
<span class="center-data kilometers">50 km</span>
</div>
<div class="products-container center-option-container">
<span class="center-bold">Products</span>
<span class="center-colon">:</span>
<span class="center-data products">
<ul>
@foreach (var product in item.ProductTitles)

<li>@product.Key x @product.Value</li>

</ul>
</span>
</div>
</div>
<div class="marker-container">
<span class="marker-outer">
<span class="marker-number">@counter</span>
</span>
</div>
</div>
<div class="item-bottom">
<div class="dots-container">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</div>
<div class="bottom-flex">
<p>
Estimated traveltime: <span class="calculated-time">39min</span> <span class="dash">-</span><br /> Afstand: <span class="calculated-kilometers">51,8km</span>
</p>
<p><span class="estimated-time"></span></p>
</div>
<!------------------------------------------>
</div>
</div>

</div>
<div class="total-container">
<p><span class="bold">Total Traveltime: </span><span class="total-time">5:30</span><span class="bold">Kilometers: </span><span class="total-km">262,8km</span></p>
</div>
</div>
<div id="mapContainer0" class="map-container"></div>
</div>
</div>
</div>









share|improve this question
























  • The javascript you describe looks like business logic that should be server side. Depending on your user base (if they are not totally trusted), you should consider doing that logic on the server.

    – bradbury9
    Mar 26 at 9:29











  • dont pay attention to the static values in the code. its just an example. Thanks for your answer :)

    – nymtes
    Mar 26 at 9:37











  • make your second container a partial view. use Action that will accept, for example a list of item ids to be moved to a second container and load it with Ajax. (if i correctly get your question)

    – Jury Golubev
    Mar 26 at 9:49













1












1








1








I have a viewmodel which contains data and is loaded in my view. To show the data in the HTML, I used some @foreach loops.



Now the page contains values from the viewmodel. For example, if the viewmodel contains 10 items, all 10 items are loaded through @foreach loops in the html.



After evertyhing is loaded, my javascript code checks how many items there are and splits the items to 2 different containers if certain conditions are met.



To give more color to the sketch:



The items are deliverables. Each deliverable has an address where it need to be delivered to. These addresses will be marked as deliverypoints on the map. The map is 1 container. So for example if I have 10 items there will be 10 marks on the map. The javascript calculates the distance and travel time between these marks. If the total deliverytime exceed 8 hours (a workday) then it extracts some items from the total itempool untill the total deliverytime in that specific container is under the 8 hours. The remainder of the deliverables will be put in another map (container).



Question



How can I post these 2 newly made containers including the items to my controller?



So what I need is is something like this:



public ActionResult RetrieveContainerIncludingItems(List<ExampleModel> Containers)


This list should contain its items.



This is my View Code:



<div class="content-container map-outer">
<div class="head">Transport</div>
<div class="content">
<div class="date-container">
</div>
<div class="map-inner">
<div class="route-container">
<div class="route-header">
<div class="truck-container">
<span class="truck-number">1</span>
</div>
<div class="starting-time-container">Starttime: <span class="starting-time">8:00</span></div>
<div class="data-right">
<span class="vehicle-number">XR-VR-95</span>
<span class="driver-name">Eric Peterson</span>
</div>
</div>
<div class="route-inner">
<!------------------------------------------>
@var counter = 0;
@foreach (var item in Model.TransportPlannerModels)

counter++;
string status = (item.Status == "Deliver") ? "route-item drop-off" : "route-item pick-up";
<div class="@status">
<div class="item-header">
<div class="item-order-container">
<span class="item-order">@counter</span>
</div>
<div class="location-type-container">
<span class="location-type">@item.Status</span>
</div>
<div class="location-address-container">
@Html.HiddenFor(x => item.Firstname)
<span class="location-address">@item.Firstname @item.LastName - @item.StreetName @item.Housenumber , @item.ZipCode <br/> @item.City</span>
</div>
<div class="icon-container">
<span class="icon icon-plus">+</span>
<span class="icon icon-minus">-</span>
</div>
</div>
<div class="item-center">
<div class="technical-info">
<span class="lat"></span>
<span class="lng"></span>
<span class="place_id"></span>
</div>
<div class="info-container">
<div class="order-number-container center-option-container">
<span class="center-bold">Ordernumber</span>
<span class="center-colon">:</span>
<span class="center-data order-number">@counter</span>
</div>
<div class="name-container center-option-container">
<span class="center-bold">Name</span>
<span class="center-colon">:</span>
<span class="center-data name">@item.Firstname @item.LastName</span>
</div>
<div class="address-container center-option-container">
<span class="center-bold">Address</span>
<span class="center-colon">:</span>
<span class="center-data address">@item.StreetName @item.Housenumber, @item.ZipCode @item.City</span>
</div>
<div class="kilometers-container center-option-container">
<span class="center-bold">Amount<br />kilometers</span>
<span class="center-colon">:</span>
<span class="center-data kilometers">50 km</span>
</div>
<div class="products-container center-option-container">
<span class="center-bold">Products</span>
<span class="center-colon">:</span>
<span class="center-data products">
<ul>
@foreach (var product in item.ProductTitles)

<li>@product.Key x @product.Value</li>

</ul>
</span>
</div>
</div>
<div class="marker-container">
<span class="marker-outer">
<span class="marker-number">@counter</span>
</span>
</div>
</div>
<div class="item-bottom">
<div class="dots-container">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</div>
<div class="bottom-flex">
<p>
Estimated traveltime: <span class="calculated-time">39min</span> <span class="dash">-</span><br /> Afstand: <span class="calculated-kilometers">51,8km</span>
</p>
<p><span class="estimated-time"></span></p>
</div>
<!------------------------------------------>
</div>
</div>

</div>
<div class="total-container">
<p><span class="bold">Total Traveltime: </span><span class="total-time">5:30</span><span class="bold">Kilometers: </span><span class="total-km">262,8km</span></p>
</div>
</div>
<div id="mapContainer0" class="map-container"></div>
</div>
</div>
</div>









share|improve this question
















I have a viewmodel which contains data and is loaded in my view. To show the data in the HTML, I used some @foreach loops.



Now the page contains values from the viewmodel. For example, if the viewmodel contains 10 items, all 10 items are loaded through @foreach loops in the html.



After evertyhing is loaded, my javascript code checks how many items there are and splits the items to 2 different containers if certain conditions are met.



To give more color to the sketch:



The items are deliverables. Each deliverable has an address where it need to be delivered to. These addresses will be marked as deliverypoints on the map. The map is 1 container. So for example if I have 10 items there will be 10 marks on the map. The javascript calculates the distance and travel time between these marks. If the total deliverytime exceed 8 hours (a workday) then it extracts some items from the total itempool untill the total deliverytime in that specific container is under the 8 hours. The remainder of the deliverables will be put in another map (container).



Question



How can I post these 2 newly made containers including the items to my controller?



So what I need is is something like this:



public ActionResult RetrieveContainerIncludingItems(List<ExampleModel> Containers)


This list should contain its items.



This is my View Code:



<div class="content-container map-outer">
<div class="head">Transport</div>
<div class="content">
<div class="date-container">
</div>
<div class="map-inner">
<div class="route-container">
<div class="route-header">
<div class="truck-container">
<span class="truck-number">1</span>
</div>
<div class="starting-time-container">Starttime: <span class="starting-time">8:00</span></div>
<div class="data-right">
<span class="vehicle-number">XR-VR-95</span>
<span class="driver-name">Eric Peterson</span>
</div>
</div>
<div class="route-inner">
<!------------------------------------------>
@var counter = 0;
@foreach (var item in Model.TransportPlannerModels)

counter++;
string status = (item.Status == "Deliver") ? "route-item drop-off" : "route-item pick-up";
<div class="@status">
<div class="item-header">
<div class="item-order-container">
<span class="item-order">@counter</span>
</div>
<div class="location-type-container">
<span class="location-type">@item.Status</span>
</div>
<div class="location-address-container">
@Html.HiddenFor(x => item.Firstname)
<span class="location-address">@item.Firstname @item.LastName - @item.StreetName @item.Housenumber , @item.ZipCode <br/> @item.City</span>
</div>
<div class="icon-container">
<span class="icon icon-plus">+</span>
<span class="icon icon-minus">-</span>
</div>
</div>
<div class="item-center">
<div class="technical-info">
<span class="lat"></span>
<span class="lng"></span>
<span class="place_id"></span>
</div>
<div class="info-container">
<div class="order-number-container center-option-container">
<span class="center-bold">Ordernumber</span>
<span class="center-colon">:</span>
<span class="center-data order-number">@counter</span>
</div>
<div class="name-container center-option-container">
<span class="center-bold">Name</span>
<span class="center-colon">:</span>
<span class="center-data name">@item.Firstname @item.LastName</span>
</div>
<div class="address-container center-option-container">
<span class="center-bold">Address</span>
<span class="center-colon">:</span>
<span class="center-data address">@item.StreetName @item.Housenumber, @item.ZipCode @item.City</span>
</div>
<div class="kilometers-container center-option-container">
<span class="center-bold">Amount<br />kilometers</span>
<span class="center-colon">:</span>
<span class="center-data kilometers">50 km</span>
</div>
<div class="products-container center-option-container">
<span class="center-bold">Products</span>
<span class="center-colon">:</span>
<span class="center-data products">
<ul>
@foreach (var product in item.ProductTitles)

<li>@product.Key x @product.Value</li>

</ul>
</span>
</div>
</div>
<div class="marker-container">
<span class="marker-outer">
<span class="marker-number">@counter</span>
</span>
</div>
</div>
<div class="item-bottom">
<div class="dots-container">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</div>
<div class="bottom-flex">
<p>
Estimated traveltime: <span class="calculated-time">39min</span> <span class="dash">-</span><br /> Afstand: <span class="calculated-kilometers">51,8km</span>
</p>
<p><span class="estimated-time"></span></p>
</div>
<!------------------------------------------>
</div>
</div>

</div>
<div class="total-container">
<p><span class="bold">Total Traveltime: </span><span class="total-time">5:30</span><span class="bold">Kilometers: </span><span class="total-km">262,8km</span></p>
</div>
</div>
<div id="mapContainer0" class="map-container"></div>
</div>
</div>
</div>






c# asp.net-mvc foreach view controller






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 9:21









Carlos Cavero

1,9724 gold badges11 silver badges26 bronze badges




1,9724 gold badges11 silver badges26 bronze badges










asked Mar 26 at 9:13









nymtesnymtes

65 bronze badges




65 bronze badges












  • The javascript you describe looks like business logic that should be server side. Depending on your user base (if they are not totally trusted), you should consider doing that logic on the server.

    – bradbury9
    Mar 26 at 9:29











  • dont pay attention to the static values in the code. its just an example. Thanks for your answer :)

    – nymtes
    Mar 26 at 9:37











  • make your second container a partial view. use Action that will accept, for example a list of item ids to be moved to a second container and load it with Ajax. (if i correctly get your question)

    – Jury Golubev
    Mar 26 at 9:49

















  • The javascript you describe looks like business logic that should be server side. Depending on your user base (if they are not totally trusted), you should consider doing that logic on the server.

    – bradbury9
    Mar 26 at 9:29











  • dont pay attention to the static values in the code. its just an example. Thanks for your answer :)

    – nymtes
    Mar 26 at 9:37











  • make your second container a partial view. use Action that will accept, for example a list of item ids to be moved to a second container and load it with Ajax. (if i correctly get your question)

    – Jury Golubev
    Mar 26 at 9:49
















The javascript you describe looks like business logic that should be server side. Depending on your user base (if they are not totally trusted), you should consider doing that logic on the server.

– bradbury9
Mar 26 at 9:29





The javascript you describe looks like business logic that should be server side. Depending on your user base (if they are not totally trusted), you should consider doing that logic on the server.

– bradbury9
Mar 26 at 9:29













dont pay attention to the static values in the code. its just an example. Thanks for your answer :)

– nymtes
Mar 26 at 9:37





dont pay attention to the static values in the code. its just an example. Thanks for your answer :)

– nymtes
Mar 26 at 9:37













make your second container a partial view. use Action that will accept, for example a list of item ids to be moved to a second container and load it with Ajax. (if i correctly get your question)

– Jury Golubev
Mar 26 at 9:49





make your second container a partial view. use Action that will accept, for example a list of item ids to be moved to a second container and load it with Ajax. (if i correctly get your question)

– Jury Golubev
Mar 26 at 9:49












2 Answers
2






active

oldest

votes


















0














View



<div id="divPartial2">
</div>


JS



 var ActionParams = new Object();
ActionParams.ItemIds= ...;

$.ajax(
type: "POST",
url: url,
cache: false,
data: JSON.stringify(ActionParams),
contentType: "application/json",
datatype: "html",
success: function (data, textStatus, jqXHR)
$("#divPartial2").html(data);
,
);


Controller



 public ActionResult FilteredItems(List<int> itemIds)

//get only items for second container
return PartialView("Container");






share|improve this answer






























    0














    $("div .map-inner").each(function(index, element) 
    var AllOrderItems = new Array();

    $($(this).find('.route-item')).each(function(index, element)
    AllOrderItems.push($(this).find('.orderItemID').val());
    )

    var MapContainer =
    DriverName: $(this).find('.driver-name').text(),
    TotalDistance: $(this).find('.total-km').text(),
    TotalTime: $(this).find('.total-time').text(),
    LicensePlate: $(this).find('.vehicle-number').text(),
    OrderItems: AllOrderItems

    AllMaps.push(MapContainer);
    )





    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353417%2fhow-to-pass-down-values-in-a-list-to-a-controller-in-c-sharp-after-the-values-in%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      View



      <div id="divPartial2">
      </div>


      JS



       var ActionParams = new Object();
      ActionParams.ItemIds= ...;

      $.ajax(
      type: "POST",
      url: url,
      cache: false,
      data: JSON.stringify(ActionParams),
      contentType: "application/json",
      datatype: "html",
      success: function (data, textStatus, jqXHR)
      $("#divPartial2").html(data);
      ,
      );


      Controller



       public ActionResult FilteredItems(List<int> itemIds)

      //get only items for second container
      return PartialView("Container");






      share|improve this answer



























        0














        View



        <div id="divPartial2">
        </div>


        JS



         var ActionParams = new Object();
        ActionParams.ItemIds= ...;

        $.ajax(
        type: "POST",
        url: url,
        cache: false,
        data: JSON.stringify(ActionParams),
        contentType: "application/json",
        datatype: "html",
        success: function (data, textStatus, jqXHR)
        $("#divPartial2").html(data);
        ,
        );


        Controller



         public ActionResult FilteredItems(List<int> itemIds)

        //get only items for second container
        return PartialView("Container");






        share|improve this answer

























          0












          0








          0







          View



          <div id="divPartial2">
          </div>


          JS



           var ActionParams = new Object();
          ActionParams.ItemIds= ...;

          $.ajax(
          type: "POST",
          url: url,
          cache: false,
          data: JSON.stringify(ActionParams),
          contentType: "application/json",
          datatype: "html",
          success: function (data, textStatus, jqXHR)
          $("#divPartial2").html(data);
          ,
          );


          Controller



           public ActionResult FilteredItems(List<int> itemIds)

          //get only items for second container
          return PartialView("Container");






          share|improve this answer













          View



          <div id="divPartial2">
          </div>


          JS



           var ActionParams = new Object();
          ActionParams.ItemIds= ...;

          $.ajax(
          type: "POST",
          url: url,
          cache: false,
          data: JSON.stringify(ActionParams),
          contentType: "application/json",
          datatype: "html",
          success: function (data, textStatus, jqXHR)
          $("#divPartial2").html(data);
          ,
          );


          Controller



           public ActionResult FilteredItems(List<int> itemIds)

          //get only items for second container
          return PartialView("Container");







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 10:20









          Jury GolubevJury Golubev

          2191 silver badge5 bronze badges




          2191 silver badge5 bronze badges























              0














              $("div .map-inner").each(function(index, element) 
              var AllOrderItems = new Array();

              $($(this).find('.route-item')).each(function(index, element)
              AllOrderItems.push($(this).find('.orderItemID').val());
              )

              var MapContainer =
              DriverName: $(this).find('.driver-name').text(),
              TotalDistance: $(this).find('.total-km').text(),
              TotalTime: $(this).find('.total-time').text(),
              LicensePlate: $(this).find('.vehicle-number').text(),
              OrderItems: AllOrderItems

              AllMaps.push(MapContainer);
              )





              share|improve this answer



























                0














                $("div .map-inner").each(function(index, element) 
                var AllOrderItems = new Array();

                $($(this).find('.route-item')).each(function(index, element)
                AllOrderItems.push($(this).find('.orderItemID').val());
                )

                var MapContainer =
                DriverName: $(this).find('.driver-name').text(),
                TotalDistance: $(this).find('.total-km').text(),
                TotalTime: $(this).find('.total-time').text(),
                LicensePlate: $(this).find('.vehicle-number').text(),
                OrderItems: AllOrderItems

                AllMaps.push(MapContainer);
                )





                share|improve this answer

























                  0












                  0








                  0







                  $("div .map-inner").each(function(index, element) 
                  var AllOrderItems = new Array();

                  $($(this).find('.route-item')).each(function(index, element)
                  AllOrderItems.push($(this).find('.orderItemID').val());
                  )

                  var MapContainer =
                  DriverName: $(this).find('.driver-name').text(),
                  TotalDistance: $(this).find('.total-km').text(),
                  TotalTime: $(this).find('.total-time').text(),
                  LicensePlate: $(this).find('.vehicle-number').text(),
                  OrderItems: AllOrderItems

                  AllMaps.push(MapContainer);
                  )





                  share|improve this answer













                  $("div .map-inner").each(function(index, element) 
                  var AllOrderItems = new Array();

                  $($(this).find('.route-item')).each(function(index, element)
                  AllOrderItems.push($(this).find('.orderItemID').val());
                  )

                  var MapContainer =
                  DriverName: $(this).find('.driver-name').text(),
                  TotalDistance: $(this).find('.total-km').text(),
                  TotalTime: $(this).find('.total-time').text(),
                  LicensePlate: $(this).find('.vehicle-number').text(),
                  OrderItems: AllOrderItems

                  AllMaps.push(MapContainer);
                  )






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 9 at 15:07









                  nymtesnymtes

                  65 bronze badges




                  65 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353417%2fhow-to-pass-down-values-in-a-list-to-a-controller-in-c-sharp-after-the-values-in%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript