MVC : Checkboxes generated using JavaScript not appearing in FormCollection on postback
Posted
by
Andy Evans
on Stack Overflow
See other posts from Stack Overflow
or by Andy Evans
Published on 2011-01-06T19:50:16Z
Indexed on
2011/01/06
19:53 UTC
Read the original article
Hit count: 294
mvc
|formcollection
I took over another project (written by one contractor, modified by another and now it's not working) written using MVC/C# where a view that has a table (see below) is dynamically populated using JSON/Javascript - the first column of which is a checkbox.
View (spark view engine)
<table id='component_list' name='component_list' cellpadding='0' border='0' cellspacing='0'>
<thead>
<tr>
<th> </th>
<th>Component</th>
<th>Component Type</th>
<th>Evenflo Part #</th>
<th>Supplier Part #</th>
<th>Supplier</th>
<th>Requirement</th>
<th>Location</th>
<th>Region</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
When the page is rendered, I look at the source for the page and do not see the table data (I wouldn't expect to see this). However, when the form is posted back, controller, the FormCollection is empty. Supposedly this had been working before the last contractor got their hands on it - which is another post all together. My goal right now is having the checkboxes in the FormCollection.
Any suggestions would be greatly appreciated.
Thanks,
© Stack Overflow or respective owner