Hello,
I'm trying to pass a List object from view to controller.
The program works by pressing the link "Add new line", this adds a new row to my web page, with a input box and i would like for that input box content, on submission, to be passed to my controller so that a can treat the data...
The code would be something like this
@model MyModel.Models.Line
@{
ViewBag.Title = "Create";
}
@{
Layout = "";
}
<h2> New Line</h2>
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
@{var lines = new List<MyModel.Models.lines>();}
<table class="createTable">
</table>
<a href="#" class="addNew">Add new line</a>
<script type="text/javascript">
$(function () {
jQuery(function () {
@{var line = new MyModel.Models.Line();}
jQuery('a.addNew').click(function (event) {
event.preventDefault();
jQuery('table.tableCreate').append('<tr><td>@Html.EditorFor(m=>line.Description)</td></tr>');
});
});
});
</script>
<input type="submit" value="OK">
}
I would like some help, please.