Prakash

Prakash

  • NA
  • 258
  • 78.6k

Convert Razor Dropdownlist in to javascript string

Jul 27 2016 9:54 AM
Hello Experts,
 
I have following javascript function but it is not working
 
function addRow() {
var html = '<tr>' +
'<td> @Html.DropDownList("productList", null, "Select", new { @class = "form-control" }) </td>' +
'<td><input type="text" id="txtAmount" class="form-control" placeholder="Amount" onkeyup="calculate();"></td>' +
'<td><input type="text" id="txtQyantity" class="form-control" placeholder="Qyantity" onkeyup="calculate();"></td>' +
'<td><input type="text" id="txtTotalAmount" class="form-control" placeholder="Total Amount"></td>' +
'<td><input type="button" id="btnadd" class="form-control btn btn-success" value="+ Add Product" /></td>' +
'<td><input type="button" id="btnremove" class="form-control btn btn-danger" value="- Remove Product" /></td>' +
'</tr>'
$(html).appendTo($("#Table1"))
};
 
 
I want to covert
@Html.DropDownList("productList", null, "Select", new { @class = "form-control" }) 
 
into html..please help me
 
Thank You 
 

Answers (4)