I have a following code in my View
<tr id="tblNewContentRow">
<td>
@Html.TextBox("txtNewAttributes", "", new { @class = "alphaonly", style = "width: 155px;" })
</td>
<td>
@{@Html.DropDownList("ddlNewValues", Model.OperandsMaxList, new { style = "height: 20px;" })
}
</td>
<td colspan="2">
@Html.TextBox("txtNewValues", "", new { @class = "numbersonly", style = "width: 250px;" })
</td>
</tr>
And i have ADD Button for the user where in they can dynamically add as much TR(Shown Above) they want in runtime.
Currently am using the below code for dynamically generating TR using JQUERY
var txtNewAttributes = '<td><input type="text" name="txtNewAttributes' + (tblRows + 1) + '" class="alphaonly" style = "width: 155px;" id="txtNewAttributes' + (tblRows + 1) + '" value="" /></td>';
var ddlNewValues = '<td><select id="ddlNewValues' + (tblRows + 1) + '" style = "height: 20px;width:75px;" /></td>';
var txtNewValues = '<td><input type="text" name="txtNewValues' + (tblRows + 1) + '" style = "width: 250px;" id="txtNewValues' + (tblRows + 1) + '" value="" /></td>';
var repeatRow = txtNewAttributes + ddlNewValues + txtNewValues;
$('#tblNewSearchAttribute tr:last').prev().after('<tr id="tblNewContentRow' + (tblRows + 1) + '">' + repeatRow + '</tr>');
But i have lot of functionality to be done on these dynamic rows after it is rendered.Currently itz bit confusing with this way to make use of the dataEntered.
My Question is
- Is there a better way i can Handle this so i can easily make use of these datas for all the Functionalities ?
- What will be the best way of implementing the above scenario ?
Please share your suggestions.
Am pretty new to MVC as well as Jquery.
Thanks