var table = document.getElementById("tablett"); var ddlfront = '<select id="ddlsubject" name="Subjects">'; var ddlback = '</select>'; //var ddls = 'Html.DropDownList("Subjects", new[] { new SelectListItem { Text = "Select Subject", Value = "Select subject", Selected = true } })'; var ddls = 'Html.DropDownListFor(model=>model.Subid, new[] { new SelectListItem { Text = "Select Subject", Value = "Select Subject", Selected = true }})'; for (var i = 0; i < jobj.length; i++) { // Create an empty <tr> element and add it to the 1st position of the table: var row = table.insertRow(0); // Insert new cells (<td> elements) at the 1st and 2nd position of the "new" <tr> element: id = "txtdatepicker3", var cell0 = row.insertCell(0); var cell1 = row.insertCell(1); var cell2 = row.insertCell(2); var num = i; //cell0.innerHTML = '@Html.TextBox("Date", string.Empty, new { @style = "width:150px;", @class = "date-picker" })'; cell0.innerHTML = '<input class="date-picker" id=' + i + ' name="Date" style="width:150px;" type="text">'; content = '<option selected="selected" value=select Subject >select subject</option>'; $.each(jobj, function (index, obj) { alert(obj.Sname + obj.Sid); //content += '<option selected="selected" value=' + obj.Sid + ' >' + obj.Sname + '</option>'; // cell2.innerHTML = '<option value="' + obj.Sid + '">' + obj.Sname + '</option>'; // $('#ddlsubj').append('<option value="' + obj.Sid + '">' + obj.Sname + '</option>'); ddls += '<option value="' + obj.Sid + '">' + obj.Sname + '</option>'; alert("one item added "); }); // content += '<option selected="selected" value=select Subject >select subject</option>'; var opt = ddls; // ddlfront + content + ddlback; //var opt = ddls + content; cell1.innerHTML = opt; cell2.innerHTML = opt;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)