Hi,
I have table designed view with four columns with four text boxes, I have given add more option to repeat 4 text boxes again depends on user. If I click on Add More button 4 text boxes are repeating but I I entered any data from in second column that data is not saving in db.
please help me How can I store all the data in db.
below is my code
<table class="table" style="font-family:Verdana; width:80%" id="table1">
<tr>
<td>@Html.DisplayNameFor(model => model.attendanceHolidaySerialNumber)</td>
<td>@Html.DisplayNameFor(model => model.attendanceHolidayDateorDay)</td>
<td>@Html.DisplayNameFor(model => model.attendanceHolidayDetails)</td>
<td>@Html.DisplayNameFor(model => model.attendanceHolidayType)</td>
</tr>
<pre lang="HTML"><tr class="data-contact-person">
<td>@Html.EditorFor(model => model.attendanceHolidaySerialNumber, new { htmlAttributes = new { @class = "form-control " } })</td>
<td>@Html.EditorFor(model => model.attendanceHolidayDateorDay, new { htmlAttributes = new { @class = "form-control " } })</td>
<td>@Html.EditorFor(model => model.attendanceHolidayDetails, new { htmlAttributes = new { @class = "form-control" } })</td>
<td>@Html.EditorFor(model => model.attendanceHolidayType, new { htmlAttributes = new { @class = "form-control " } })</td>
<td>
<button type="button" id="btnAdd" class="btn btn-xs btn-primary classAdd">Add More</button>
</td>
</tr>
<br />
<script type="text/javascript"><br />
<br />
$(document).ready(function () {<br />
$(document).on("click", ".classAdd", function () {<br />
var rowCount = $('.data-contact-person').length + 1;<br />
var contactdiv = '<tr class="data-contact-person">' +<br />
'<td>@Html.EditorFor(model => model.attendanceHolidaySerialNumber, new { htmlAttributes = new { @class = "form-control " } })' + rowCount + ' </td>'+ <br />
'<td>@Html.EditorFor(model => model.attendanceHolidayDateorDay, new { htmlAttributes = new { @class = "form-control " } })' + rowCount + '</td>'+ <br />
'<td>@Html.EditorFor(model => model.attendanceHolidayDetails, new { htmlAttributes = new { @class = "form-control" } })' + rowCount + '</td>' +<br />
'<td>@Html.EditorFor(model => model.attendanceHolidayType, new { htmlAttributes = new { @class = "form-control " } })' + rowCount + '</td>' +<br />
'<td><button type="button" id="btnAdd" class="btn btn-xs btn-primary classAdd">Add More</button>' +<br />
'<button type="button" id="btnDelete" class="deleteContact btn btn btn-danger btn-xs">Remove</button></td>' + <br />
'</tr>';<br />
$('#table1').append(contactdiv);
});<br />
});<br />
</script><br />
<script><br />
$(document).on("click", ".deleteContact", function () {<br />
$(this).closest("tr").remove();
});<br />
</script><br />
What I have tried:
I post my code in describe the problem window because I could not know the format how to post the code in what have you tried window.
Please suggest me. How do I can store the data in database.
thank you