Note that there are some explanatory texts on larger screens.

plurals
  1. POGet data from unordered lists that are dynamically added to the page
    primarykey
    data
    text
    <p>I'm having a page where I can create some configuration sections and the page is structured as follows: It has a button that adds a partial view to the page (using an AJAX call) and on this partial view I have:</p> <ul> <li>Dropdown to select the section</li> <li>List of available items</li> <li>List of selected items</li> </ul> <p>The list of selected items is populated using jQuery UI (sortable) via drag&amp;drop. The items above can be repeated as much as the user wants. And I want to pass to the controller the data selected from all the dropdowns and from all the lists of selected items.</p> <p>I have no idea how I can use a <code>@model</code> or even the <code>ViewBag</code> because the selected items list is initially empty and gets populated on the client side. As a side note, I don't need the list of available stuff.</p> <p><strong>UPDATE:</strong></p> <p>I've changed the question because I'm willing to put all the data in a form and I gave up the idea to use javascript to collect the data and make a request to my controller. So now I'm trying to use the <code>FormCollection</code> to get the data. The only problem is that when I submit the form <code>FormCollection</code> has no data in it.</p> <p><strong>UPDATE 2:</strong></p> <p>After looking into the FormCollection and ModelBinding I've came upon an impediment. I can't get the items on the form that don't have the <code>name</code> property. The problem is that the <code>&lt;ul&gt;</code> or <code>&lt;li&gt;</code> elements don't have the <code>name</code> attribute. So the question would be, how can I get the data from those elements using the above mentioned methods if they don't have <code>name</code> ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload