I am able to populate Editor programmatically from my model using Alexander's code snippet from http://www.telerik.com/forums/how-do-i-set-the-value-to-a-model-value-in-a-template-7d3339946e0d.
However, when I try to populate editor using an Ajax call (based on a selection in a dropdownlist), then it stops working. I can see the correct values are being returned and my other bound fields are populating correctly, just not the Editor textarea.
My editor:
@(Html.Kendo().EditorFor(m => m.Content)
.Name(
"Content"
)
.HtmlAttributes(
new
{ style =
"height:650px"
, aria_label =
"editor"
})
)
and my Jquery:
$(
function
() {
$(
'#Name'
).change(
function
() {
var
name = $(
this
).val();
var
success =
function
(results) {
debugger;
$(
'#Id'
).val(results.Id);
$(
'#Name'
).val(results.Name);
$(
'#NewName'
).val(results.Name);
$(
'#Content'
).val(results.Content);
};
$.ajax({
url:
'/Staff/Email/GetEmail'
,
type:
'POST'
,
data: {
name: name
},
dataType:
'json'
,
success: success
});
});
});
The textarea has an id of 'Content', so why can't I set it's value using Jquery?
Thank you in advance,
Laura