Jaima Joseph

Jaima Joseph

  • NA
  • 94
  • 105.6k

How to add a dropdownlist, on click of button in MVC view?

Apr 1 2014 3:33 AM
Hii,
Any help??
I have to add a row with some text boxes and a dropdownlist, dynamically  on click  of an AddRow button and the dropdownlist should list values from database.And on click of Submit button I want to send the values of all these controls to the controller.I have implemented this using all textboxes instead of one dropdownlist , using javascript and it works fine now I want to change one textbox to dropdown list.
$(".addbtn").click(function () {
var newRow = '<tr>' +
'<td><input type="text" id="SupplierName" name="SupplierName" style="width:100px;" onclick="onClickSupplr()"/></td>' +
'<td><input type="text" id="Price" name="Price" style="width:75px;" class="clsPrice" /></td>' +
'<td><input type="text" id="Quantity" name="Quantity" style="width:75px;" class="clsQty"/></td>' +
'<td><input type="text" id="datepicker" name="datepicker" style="width:75px;" class="test"/></td>' +
'<td><input type="text" id="CreditTerm" name="CreditTerm" style="width:75px;" onclick="onClickCr()"/>' +
'<td><input type="text" id="datepicker1" name="datepicker1" style="width:75px;" class="test"/></td>' +
'<td><input type="text" id="datepicker2" name="datepicker2" style="width:75px;" class="test"/></td>' +
'<td><input type="text" id="CommMode" name="CommMode" style="width:75px;" onclick="onClickComMode()"/></td>' +

'</tr>';
$('#myTable tr:last').after(newRow);
});
 Now I want to use a dropdownlist instead of 'CreditTerm' textbox and it should list some values from database.
Any help ??please....
 

Answers (2)