I have issue with the radio button is not displaying. This is when the I edit the applicant and it is not populated the radio button value from the server. The issue here I think it is at the UI as I am able to see all the values in from the controller.
<
div
class
=
"radio-group"
>
<
div
data-bind
=
"source:applicantTypeItems"
data-template
=
"DoctoralLevelId"
></
div
>
<
script
id
=
"DoctoralLevelId"
type
=
"text/x-kendo-template"
>
<
div
>
<
input
type
=
"radio"
name
=
"DoctoralLevelId"
data-bind="attr:{value:value},
checked:DoctoralLevelId" />
<
label
data-bind
=
"text:caption"
></
label
>
</
div
>
</
script
>
</
div
>
<
script
>
$(document).ready(function () {
var applicantVm =kendo.observable($.extend({
updated: false,
PersonId: self.personId,
Id: self.selectedId,
DoctoralLevelId: 1,
name: "DoctoralLevelId",
applicantTypeItems: [
{ caption: "Pre-doc", value: 1},
{ caption: "Post-doc", value: 2 },
],
// call controller and update user input
updateApplicant : function() {
var self = this;
var updateData ={
PersonId: self.personId,
Id: self.selectedId,
DoctoralLevelId: self.DoctoralLevelId,
};
$.ajax({
url: '@Url.Content("~/Applicant/UpdateNewPredoc")',
data: JSON.stringify(updateData),
contentType: "application/json, charset=utf-8",
type: "POST",
datatype: "json",
error: function () {
toastr.error('Update failed!');
},
success: function (value) {
window.console && console.log(self);
window.console && console.log(value);
toastr.success('Update succeed!');
},
complete: function () {
window.console && console.log("completed");
}
});
}
},@(Html.ToJson(Model))));
window.console && console.log(applicantVm);
kendo.bind($("#applicant-info-view"), applicantVm);
})
</
script
>