Here I am trying to display the modal popup window with one text area and two dropdowns in a row. And I am trying to add row by clicking "AddNewRow" button in same popup window. For this I have written Javascript function.
Java Script function for Adding row.
<SCRIPT TYPE="text/javascript">
function addRow() {
var tbody = document.getElementById(modaltable).getElementsByTagName("TBODY")[0];
// create row
var row = document.createElement("TR");
// create table cell 1
var td1 = document.createElement("TD");
var strHtml1 = "<FONT SIZE=\"+3\"></FONT>";
td1.innerHTML = strHtml1.replace(/!count!/g, count);
var td2 = document.createElement("TD")
var strHtml2 = "<SELECT NAME=\"Alpha-Numeric Scramble\"><OPTION VALUE=\"Alpha-Numeric Scramble\">Alpha-Numeric Scramble<OPTION VALUE=\"Packed-Decimal Scramble\">Packed-Decimal Scramble<OPTION VALUE=\"Date-Time Scrambler\">Date-Time Scrambler</SELECT>";
td2.innerHTML = strHtml2.replace(/!count!/g, count);
var td3 = document.createElement("TD")
var strHtml3 = "<SELECT NAME=\"Yes\"><OPTION VALUE=\"Yes\">Yes<OPTION VALUE=\"No\">No</SELECT>";
td2.innerHTML = strHtml3.replace(/!count!/g, count);
row.appendChild(td1);
row.appendChild(td2);
row.appendChild(td3);
count = parseInt(count) + 1;
// append row to table
tbody.appendChild(row);
}
</script>
This is For modal popup design.
<table class="table .table-responsive" id ="modaltable">
<tbody>
<tr>
<td ><textarea class="form-control" id="comment" ></textarea></td>
<td ><div class="dropdown">
<asp:DropDownList ID="DropDownList2" runat="server" CssClass="selectpicker">
<asp:ListItem Text="Alpha-Numeric Scramble"/>
<asp:ListItem Text="Packed-Decimal Scramble"/>
<asp:ListItem Text="Date-Time Scrambler"/>
</asp:DropDownList>
</div></td>
<td><div class="dropdown">
<asp:DropDownList ID="DropDownList1" runat="server" CssClass="selectpicker">
<asp:ListItem Text="Yes"/>
<asp:ListItem Text="No"/>
</asp:DropDownList>
</div></td></tr></tbody></table>
These are buttons in modal popup,
<div class="modal-footer">
<asp:Button ID="Addnewrow" runat="server" CssClass="btn btn-primary" Text="Add New Row" OnClientclick= "addRow()"/>
Here If I click "AddNewRow" button one row should add.
Unfortunately not able to displaying. What's the error in the above Java script. Any help Please.