RadAlert Error With HTML Content

4 posts, 0 answers
  1. RainMaker
    RainMaker avatar
    2 posts
    Member since:
    Nov 2011

    Posted 28 Nov 2018 Link to this post

    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>
  2. Vessy
    Admin
    Vessy avatar
    2062 posts

    Posted 03 Dec 2018 Link to this post

    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.
  3. RainMaker
    RainMaker avatar
    2 posts
    Member since:
    Nov 2011

    Posted 06 Dec 2018 in reply to Vessy Link to this post

    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.
  4. Vessy
    Admin
    Vessy avatar
    2062 posts

    Posted 07 Dec 2018 Link to this post

    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.
Back to Top