问题
Responseenter image description hereI have a kendo grid displaying ID,NID,SID(Student table) and some other fields.Now when i want to add new Student the NID field must me a dropdownlist populating the values from the database. How can we do this. What should be in the data-source . I wrote a query to get the NID. but how would i use it. Or is this wrong Thanks
<div>
<table>
<tr>
<td>
<div>
<label for="ID">ID</label>
</div>
<div data-container-for="data.ID">
<input id="id" data-bind="value: data.ID" style="width: 250px;" name="ID" type="text" />
</div>
</td>
</tr>
<tr>
<td>
<div>
<label for="NID" id="lcid">NID</label>
</div>
<div>
<input id="cid" />
</div>
</td>
<td>
</td>
</tr>
</table>
</div>
Service:
$(document).ready(function () {
$("#cid").kendoDropDownList({
dataTextField: "NID",
dataValueField: "NID",
dataSource: {
transport: {
read: {
dataType: "jsonp",
url: "/Services/getNID",
}
}
}
});
});
来源:https://stackoverflow.com/questions/35851695/kendo-ui-dropdownlist