window message don't popup when call OnGridCreated = "alert('test\ntest');"

2 posts, 0 answers
  1. kenghot
    kenghot avatar
    31 posts
    Member since:
    Feb 2007

    Posted 11 Apr 2009 Link to this post

    Hi,
        i have try to popup message when using radgrid with Ajax enabled. after try with command:
    RadGrid1.ClientSettings.ClientEvents.OnGridCreated = "alert('test');"
    is works but when i try  with :
    RadGrid1.ClientSettings.ClientEvents.OnGridCreated = "alert('test\ntest');"   ' (put new line)
    window message don't popup and got an error message: Unterminated string constant

    This error happened with both IE7 and Firefox

    BR,
    Kenghot
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 13 Apr 2009 Link to this post

    Hello Kenghot,

    I believe the produced HTML code contains illegal JavaScript. I suppose the output contains something like this:
    <script> 
     
    ... 
    alert('test
    test); 
    .... 
     
    </script> 

    Unlike HTML, JavaScript strings cannot spread more than one line without being closed.

    I will suggest you try setting the alert message like this:
    RadGrid1.ClientSettings.ClientEvents.OnGridCreated = "alert('test\\ntest');"  

    Best regards,
    Georgi Krustev
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top