Model's binded property holds valid HTML but the editor show it as raw instead of formatted

3 Answers 228 Views
Editor
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
DoomerDGR8 asked on 19 Oct 2022, 02:20 PM | edited on 19 Oct 2022, 02:22 PM

I'm facing an issue where I can successfully save HTML text to DB using the Editor. Still, upon loading the exact text (with all the formatting tags), the Editor refuses to format it correctly and displays it as plain text:

@* Background *@
<div class="row mt-3">
	<div class="col-12">
		@Html.LabelFor(m => m.BackgroundConcessionaireContract, "Background of Concessionaire/Contract *", new { @class = "col-12 control-label" })
		<kendo-editor   for="BackgroundConcessionaireContract" style="height:350px" aria-label="editor"
				placeholder="Background of Concessionaire/Contract">
			<tools>...</tools>
		</kendo-editor>
	</div>
</div>

<hr class="cm-hr" />

@* Proposal Details *@
<div id="divProposalDetails" class="row mt-3">
	<div class="col-12">
		@Html.LabelFor(m => m.CommercialTermsDetails, "Commercial Terms Details *", new { @class = "col-12 control-label" })
		<kendo-editor   for="CommercialTermsDetails" style="height:350px" aria-label="editor"
				placeholder="Commercial Terms Details">
			<tools>...</tools>
		</kendo-editor>
	</div>
</div>

<hr class="cm-hr" />

@* Financial Analysis *@
<div class="row mt-3">
	<div class="col-12">
		@Html.LabelFor(m => m.FinancialAnalysis, "Financial Analysis *", new { @class = "col-12 control-label" })
		<kendo-editor   for="FinancialAnalysis" style="height: 350px" aria-label="editor"
				placeholder="Financial Analysis">
			<tools>...</tools>
		</kendo-editor>
	</div>
</div>

In the model, the fields are defined simply as:

public string BackgroundConcessionaireContract { get; set; }
public string CommercialTermsDetails { get; set; }
public string FinancialAnalysis { get; set; }

The output is like this:

DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
commented on 20 Oct 2022, 10:33 AM

I need urgent help.
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
commented on 21 Oct 2022, 07:37 AM

I also noted that If I don't correct the unformatted plain text and save again, the editor saves even more obscured characters and this keeps happening:

A simple

Test

became

<strong>T</strong>est

and then became

&amp;lt;strong&amp;gt;T&amp;lt;/strong&amp;gt;est

3 Answers, 1 is accepted

Sort by
0
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
answered on 24 Oct 2022, 02:19 AM
I need help on this as I'm unable to understand this even with m,y own research. There is nothing similar reported out there.
0
Stoyan
Telerik team
answered on 24 Oct 2022, 12:15 PM

Hi Hassan,

I wasn't able to reproduce the reported issue and suspect that it might be caused by the Encoded configuration of the Editor or the way the value of the Component is set.

Could you please try turning off the Html encoding of the Editor to see if that is the cause of the problem.

<kendo-editor   for="BackgroundConcessionaireContract" style="height:350px" aria-label="editor" placeholder="Background of Concessionaire/Contract" encoded="false">
</kendo-editor>

If the issue persists, please consider sharing an isolated sample project that saves the content of the Editor locally and then sets it to reproduce the issue. This will enable me to investigate the reported behavior further and suggest a possible solution.

Thank you for your cooperation in advance.

Regards,
Stoyan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
commented on 24 Oct 2022, 06:43 PM

Hi. I actually tried that by setting Encoded to true and false and the Editor still fails to render formatting on HTML text. I will try to share a project but it won't be easy due to the full template. 
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
commented on 25 Oct 2022, 02:58 AM

Where can I share the project? It can't be public.
Stoyan
Telerik team
commented on 25 Oct 2022, 01:01 PM | edited

Hi Hassan,

I examined your profile and noticed that you are eligible for Priority Support which allows you to open unlimited number of tickets in our Support Portal where your questions and the answers we provide are private.

Therefore I suggest you head to your Telerik's account Support Center to open a new support thread and attach the sample there. You can link this thread to let us know it is a continuation of the communication here. We aim to answer Priority Support threads in 24hours.

Furthermore to ensure that any sensitive data is protected, please ensure to replace it with dummy data for the purposes of debugging the issue.

I hope the information above is helpful. Looking forward to your reply.

0
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
answered on 25 Oct 2022, 03:26 PM
In an effort to set up a smaller skimmed version of my project, I realized that setting Encoded to false solves the issue. I'll now figure out whats preventing the Editor to work on my main solution.
Stoyan
Telerik team
commented on 27 Oct 2022, 03:14 PM

Thank you for starting to set up a sample project to allow me to continue the investigation of the issue.

I am glad that in the process you've found how to resolve the issue in the sample project. Hopefully its useful in the main solution as well.

If further issues arise, don't hesitate to contact us.
Tags
Editor
Asked by
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
Stoyan
Telerik team
Share this question
or