Completed
Last Updated: 09 Jun 2020 10:35 by ADMIN
Release R2 2020 SP1
Steve
Created on: 05 May 2020 14:55
Category: Forms/Dialogs/Templates
Type: Bug Report
0
Rad Markup Dialog saving & symbol

I'm having an issue when using the RadMarkupDialog control where the & symbol is not being saved correctly.  All other symbols seem to be encoded which is causing a problem.  

Using the control, if I put the following in the markup section:

<span style="font-size: 16pt">Test of the &amp; symbol.&nbsp;<br />Test of the&nbsp;&lt; symbol.</span>

When I click the Apply button and close the dialog, grabbing the Value (Dialog.value) gives me the following:

<html><span style="font-size: 16pt">Test of the & symbol. <br />Test of the &lt; symbol.</span></html>
As you can see the < character is properly encoded as &lt; but the & character is not encoded.  This is causing an error in other places.  How can I get the & character to be returned as &amp; from the dialog? 

 

 

5 comments
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 08 May 2020 04:37

Hello, Steve,

I have attached my sample project and a gif file illustrating the steps that I performed for your reference.

Please give it a try and see how it would work on your end. If you are still experiencing any further difficulties, it would be greatly if you can specify what differs on your end and what steps I need to perform in order to replicate the undesired behavior that you are facing. Thus, we would be able to think about a suitable solution. Thank you in advance for your cooperation.

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Steve
Posted on: 07 May 2020 13:00
That didn't work.  Using the code you provided results in tb.text being an empty string.
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 07 May 2020 05:28

Hello, Steve, 

After further investigating the HTML parsing, I can confirm that even though the Internet Explorer's engine is used internally, the obtained behavior is an issue with RadMarkupEditor because the value is simplified by replacing "&nbsp;" with " " and "&amp;" with "&".

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to use reflection and extract the content from the HTMLView:

        Dim dialog As RadMarkupDialog = New RadMarkupDialog()
        Dim result As DialogResult = dialog.ShowDialog()

        If result = DialogResult.OK Then
            Dim fi As FieldInfo = GetType(RadMarkupEditor).GetField("htmlView", BindingFlags.NonPublic Or BindingFlags.Instance)
            Dim tb As TextBox = TryCast(fi.GetValue(dialog.Editor), TextBox)

            MessageBox.Show(tb.Text)
        End If

I believe that it would be suitable for your scenario.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Steve
Posted on: 06 May 2020 13:25
That only works in cases where there is a space after the & symbol.  It would not work if someone typed in characters immediately after the &.  This is not a good solution and based on your response it seems you have no intent on fixing/resolving it.  That's frustrating.
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 06 May 2020 09:53

Hello, Steve, 

Following the provided information, I have tested with the specified mark-up text and obtained the following result:

Indeed, the "&amp;" text is replaced by the respective symbol "&". Our Markup Editor uses the rendering engine of Internet Explorer.

The easiest solution that I can suggest is to directly replace the "&" with the HTML equivalent. 

        Dim dr As DialogResult = Me.RadMarkupDialog1.ShowDialog()
        If dr = Windows.Forms.DialogResult.OK Then

            Dim text = Me.RadMarkupDialog1.Value.Replace(" & ", " &amp; ")
            Me.RadRichTextEditor1.Text = text
            Me.RadTextBox1.Text = text
        En

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.