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

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

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kenghot
Top achievements
Rank 1
kenghot asked on 11 Apr 2009, 11:40 AM
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

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 13 Apr 2009, 04:24 PM
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.
Tags
Grid
Asked by
kenghot
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or