Microsoft
Software
Hardware
Network
Question : New lines for Javascript's Confirm in .NET
Hello,
I'm writing an application in .NET 2.0 (C#)
I'm adding an "OnClick" attribute to my buttons in my data controls (number of them) like this:
( ( Button )(( DataListItem )e.Item ).FindControl( "btnPerformTask" )).Attributes.Add( "OnClick", "return confirm('" + Message.PerformTask + "');" );
Message. - is the class that combines a number of messages. In the class I have the following definition:
public static string PerformTask = "First part of the message. Second part of the message";
What I'm trying to achieve is to have these two parts on two lines and preferrably center-aligned. If I add \n\r anywhere in my string, the javascript will fail giving "unterminated string" message.
I tried adding Environment.NewLine - same result. I have tried a few other less obvious things but didn't get anywhere at all :(
Would appreciate you help on this.
Thank you
Answer : New lines for Javascript's Confirm in .NET
try this
public static string PerformTask = @"First part of the message. \\n\\r Second part of the message";
Random Solutions
Certificate for WPF application
How to open website (hosted on Win Server 2008, IIS) in Microsoft Frontpage 2000?
Printing to LPT2
To covert an access report with pictures to any editable document format retaining all the graphics and other formatting settings
SQL Select Distinct Results (Complex)
How do I setup a network with cross over cable between server 2008 and server 2003? 500pnts
Exchange 2007 - Transport Rule
How do I force a '0' value into a report
Outlook closes as soon as it starts
Windows7 in a 2003 domain