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
Access to SQL ODBC Connection without the ODBC SQL Login Screen
Saving a filename with the week number of the last sunday
SQL query to select distinct ID for latest date past June/01/2009 where there are (possibly) more than one occurrence of each ID
Combining Arrays in VBA
Excel vba: post 21 - based on prev EE post - msoshape - parameters question
Vista command prompt
The store driver couldn't deliver the public folder replication message. Property Validation Failed when replicating public folders in mixed 2003/2007 evironment
VB.Net assign a class to each tab control page
Tray 900 Unable to Set Tray Icon error. How do I clear it when Windows XP Pro starts?
LaCie 1TB HD will not show up in My Computer