html data doesn't set in my ckeditor in ajax post via json

585 Views Asked by At

i have used ckeditor in my page:

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content runat="server" ID="AdminMainContent" ContentPlaceHolderID="AdminMainPlace">
                        <asp:Label ID="lblDesc" runat="server" Text="توضیحات">
                        </asp:Label>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                            ValidationGroup="group1" EnableClientScript="true"
                            ControlToValidate="CKEditor1" ForeColor="Red" Text="*" />
                        <CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" HtmlEncodeOutput="true" runat="server" AutoGrowMinHeight="120"></CKEditor:CKEditorControl
</asp:Content>

when i click on grid row , it uses ajax post to get value for setting in ckeditor:

 $.ajax({
        url: '<%=ResolveUrl("Default.aspx/GetNews")%>',
        data: JSON.stringify({ id: $("#AdminMainPlace_SelectedRow").val() }),
        type: "post",
        contentType: "application/json",
        dataType: "JSON",
        timeout: 10000,
        success: function (result) {
            if (result) {
                $('#AdminMainPlace_txtTitle').val(result.d.NewsTitle);
                $('#AdminMainPlace_txtSummary').val(result.d.NewsSummary);
                $('#AdminMainPlace_imgpreview').attr('src', result.d.NewsImage);
                $('#AdminMainPlace_NewsImage').val(result.d.NewsImage);
                CKEDITOR.instances['AdminMainPlace_CKEditor1'].setData(result.d.NewsDescription)
            }
        }
    });

but after getting data ,'result.d.NewsDescription' has html data but it isn't set to my ckeditor. how can i solve it?

0

There are 0 best solutions below