Reading only one row from table in model binder
Posted
by user281180
on Stack Overflow
See other posts from Stack Overflow
or by user281180
Published on 2010-04-09T12:19:04Z
Indexed on
2010/04/09
12:23 UTC
Read the original article
Hit count: 270
jQuery
I am filling a table dynamically. I can see the table filled with 3 rows, but in my model binder I can read only one value. How can I solve this problem? My code is as follows:
function AddTableRow(jQtable, value, text){
var count = 0;
jQtable.each(function() {
var $table = $(this);
var tds = '<tr>';
tds += '<td>' + '<input type="text" value = ' + text + ' disabled ="disabled" style="width:auto"/>' + '<input type="hidden" name="projectList[' + count + '].ID" value = ' + value + ' /></td>' + '<td><input type="button" value="Remove"/></td>';
tds += '</tr>';
if ($('tbody', this).length > 0) {
$('tbody', this).append(tds);
}
else {
$(this).append(tds);
}
count++;});
}
function ReadSelectedProject() {
$("#Selected option").each(function() {
AddTableRow($('#projectTable'), $(this).val(), $(this).text());
});
}
© Stack Overflow or respective owner