PDA

View Full Version : javaScript alert messages


akshatha306
06-21-2006, 09:12 AM
:thumbsup: In the procedure in the .cs file i have a line of code as follows where i will call an alert message.. (i Dont want to do this in the pageload using ONCLICK)

myPage.RegisterStartupScript("Continue","<script>alert('The account has valid claim information entered in the grid.Either answer the question Yes or delete all the information in the grid');</script>");

The message i want to display is :

"The account has no valid claim information entered in the grid. Either
answer the question ‘No’ or add valid claim information into the grid. Zero
is valid if the policy had no claims during the experience period."

With same apostrophes for No and the message should come in three line in the same format. How do i do this.

Right now its displaying the message but without apostrophes and in one single line
I dont want to do it writing a function in HTML page and calling it. Is there a way of doing it in the same alert message.

Brandoe85
06-21-2006, 09:31 AM
The new line character is "\n" and escape your apostrophes with '\'.

Good luck;

akshatha306
06-21-2006, 11:20 AM
ya but i cant use "\n" inside the outer "<script>----</script>"
you mean
myPage.RegisterStartupScript("Continue","<script>alert('The account has valid claim information entered in the grid."\n" Either answer the question Yes or delete all the information in the grid');</script>");

Same with \' it doesnt work
Could u please tell me how to insert the characters into my code

akshatha306
06-21-2006, 11:25 AM
ya but i cant use "\n" inside the outer "<script>----</script>"
you mean
myPage.RegisterStartupScript("Continue","<script>alert('The account has valid claim information entered in the grid."\n" Either answer the question Yes or delete all the information in the grid');</script>");

Same with \' it doesnt work
Could u please tell me how to insert these characters into the above code snippet

otaku149
06-21-2006, 03:29 PM
This should work:

The account has no valid claim information entered in the grid. Either \\n answer the question \\'No\\' or add valid claim information into the grid. Zero \\n is valid if the policy had no claims during the experience period.