Pratik Shirse

Pratik Shirse

  • 1.2k
  • 581
  • 65.3k

how to save dynamically created HTML Control using c#

Jan 31 2017 7:46 AM
Dear Team,
 
how to save dynamically created HTML Control using c# 
 
<div class="tbldivworker">
<table class="table table-hover small-text" id="tb">
<tr class="tr-header">
<th>Sr</th>
<th>Name</th>
<th>DOB</th>
<th>Aadhar No</th>
<th>Relation</th>
<th>Education</th>
<th>Profession</th>
<th>Percentage</th>
<th><a href="javascript:void(0);" style="font-size: 18px;" id="addMore" title="Add More Person"><span class="btn btn-success fa fa-plus"></span></a></th>
<tr>
<td></td>
<%--//use for sr no.--%>
<td>
<input type="text" name="fullname[]" class="form-control input-sm" placeholder="Name" runat="server"></td>
<td>
<input type="text" id="txtFamilyDate" name="txtFamilyDate[]" placeholder="Select DOB" class="form-control input-sm" /></td>
<td>
<input type="text" id="Text1" name="txt_aadharNo[]" class="form-control input-sm" placeholder="Aadhar No" runat="server"></td>
<td>
<select name="cmb_relation[]" class="form-control input-sm" runat="server">
<option value="" selected disabled>Select Relation</option>
<option value="Self">Self</option>
<option value="Husband">Husband</option>
<option value="Wife">Wife</option>
<option value="Doughter">Doughter</option>
</select></td>
<td>
<select name="cmb_Education[]" class="form-control input-sm" runat="server">
<option value="" selected disabled>Select Education</option>
<option value="Engineer">Engineer</option>
<option value="Accountant">Accountant</option>
</select>
</td>
<td>
<select name="cmb_Education[]" class="form-control input-sm" runat="server">
<option value="" selected disabled>Select Profession</option>
<option value="Worker">Worker</option>
<option value="Labour">Labour</option>
</select>
</td>
<td>
<input type="checkbox" name="checkBox[]" class="form-control input-sm"></td>
<td><a href='javascript:void(0);' class='remove'><span class="btn btn-danger fa fa-remove"></span></a></td>
</tr>
</table></div>
 
 
 =========================
 
<script src="assets/js/jquery-1.11.1.min.js"></script>
<script>
$(function(){
$('#addMore').on('click', function() {
var data = $("#tb tr:eq(1)").clone(true).appendTo("#tb");
data.find("input").val('');
});
$(document).on('click', '.remove', function() {
var trIndex = $(this).closest("tr").index();
if(trIndex>1) {
$(this).closest("tr").remove();
} else {
alert("Sorry!! Can't remove first row!");
}
});
});
</script>
 

Answers (1)