Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC viewmodel array not being populated
    text
    copied!<p>I have an action which takes a viewmodel. </p> <pre><code>[HttpPost] public JsonResult SearchAjax(JQueryDataTablesModel jQueryDataTablesModel, BloodSearchAjaxViewModel searchModel) { ... </code></pre> <p>In that viewmodel there is an array</p> <pre><code>public ReadOnlyCollection&lt;string&gt; mDataProp_ { get; set; } </code></pre> <p>When I call the action I verify via fiddler that the array data is being passed</p> <p><img src="https://i.stack.imgur.com/URd0A.jpg" alt="enter image description here"></p> <p>However, the array (as well as other arrays in the viewmodel) are null.</p> <p>Also, if I put in the viewmodel a field called<code>mDataProp_0</code> it gets populated.</p> <p>Updated based on comment. Here is the code from the view where the data is posted. I'm using a jQueryDataTable. I didn't think this code mattered since I verified that the data is in the http request.</p> <pre><code>/* Initialize table */ var oTable = $('#search-results-table').dataTableWithFilter({ "sDom": "&lt;'row'&lt;'span6'l&gt;&lt;'span6'f&gt;r&gt;t&lt;'row'&lt;'span6'i&gt;&lt;'span6'p&gt;&gt;", "sPaginationType": "bootstrap", "bProcessing": true, "bServerSide": true, "sAjaxSource": 'SearchAjax', "sServerMethod": "POST", "aoColumns": [ { "mDataProp": "BloodIdentificationNumber" }, { "mDataProp": "Status" }, { "mDataProp": "ExpirationDate" }, { "mDataProp": "CompanyName" }, { "mDataProp": "Location" }, { "mDataProp": "City" } ], // Initialize our custom filtering buttons and the container that the inputs live in filterOptions: { searchButton: "search-button", clearSearchButton: "clear-search-button", searchContainer: "search-block" } }); </code></pre> <p>Any ideas? Thanks!</p>
 

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