This is a migrated thread and some comments may be shown as answers.

RadAlert Error With HTML Content

3 Answers 214 Views
Window
This is a migrated thread and some comments may be shown as answers.
RainMaker
Top achievements
Rank 1
RainMaker asked on 28 Nov 2018, 10:56 PM
I have a radalert that we are trying to load HTML content into server side.  For some reason if there are multiple paragraph tags it causes the javascript to error with "Invalid or unexpected token". It looks like it placed the 2nd paragraph on a new line.  Is there a workaround for something like this?

 

This is what is rendered when there are multiple paragraph tags and the error is thrown:

<script type='text/javascript' id='7221d910'>
                     function RadWindowManager1_radalert_7221d910()
                     {
                       $find('RadWindowManager1').radalert('<p><strong><span style="font-size: 24px;">This is the <span style="color: #c00000;">sold out</span> message </span></strong></p>
<p><strong><span style="font-size: 24px;">Just another paragraph</span></strong></p>', null, null, 'Sold Out', null, 'null');
                       Sys.Application.remove_load(RadWindowManager1_radalert_7221d910);
                       var scriptBlock = document.getElementById('7221d910');
                       if(scriptBlock)
                       {
                           var parent = scriptBlock.parentNode;
                           if(parent) parent.removeChild(scriptBlock);
                       }
                  };
                  Sys.Application.add_load(RadWindowManager1_radalert_7221d910);</script>

 

This throws the error:

<p><strong><span style="font-size: 24px;">This is the <span style="color: #c00000;">sold out</span> message </span></strong></p>  <p><strong><span style="font-size: 24px;">Just another paragraph</span></strong></p>

 

This works correctly:

<p><strong><span style="font-size: 24px;">This is the <span style="color: #c00000;">sold out</span> message </span></strong><strong><span style="font-size: 24px;">Just another paragraph</span></strong></p>

3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 03 Dec 2018, 06:54 PM
Hello,

Can you, please, share the exact setup that is leading to the issue? How are you loading the content into the WindowManager - are you using the following approach?
https://www.telerik.com/support/kb/aspnet-ajax/window/details/calling-radalert-from-codebehind-(all-versions-of-radwindow)

For convenience, I am attaching a small sample calling the provided Javascript function and it is working properly at my end. Can you test it and see if it is working for you as well?

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
RainMaker
Top achievements
Rank 1
answered on 06 Dec 2018, 09:55 PM
Thanks for getting back with us Vessy.  We figured out what the issue was.  The editor was adding carriage return line feeds in between the paragraph tags which caused the javascript to error out.
0
Vessy
Telerik team
answered on 07 Dec 2018, 07:24 AM
Hello,

Thanks a lot for the update - I am really glad you have found the root of the problem :)

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Window
Asked by
RainMaker
Top achievements
Rank 1
Answers by
Vessy
Telerik team
RainMaker
Top achievements
Rank 1
Share this question
or