Reputation: 887
I am not sure why, but I am getting issues with a Javascript alert inside of an ASP application within the PageLoad() function. It processes fine, but when I try another action I get the following error (This also only occurs in IE and Visual Studio (in debug mode) ) :
Line: 4056
Error: Unspecified error.
Response.Write("<script language='javascript'>alert(' You currently have an incomplete quote.\\n Here is your customers information: \\n First Name: " + _firstName + " \\n Last Name: " + _lastName+ " \\n Number Of Drivers: " + _driveList.Count().ToString() + " \\n Number Of Vehicles: " + _vehicleList.Count().ToString() + " \\n Date Of Quote: " + _pendingQuote.Date.ToString() + " ')</script>");
Upvotes: 0
Views: 137
Reputation: 6612
why dont you use script manager
ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", string.Format("alert('{0}');",alertText ), true);
and create Alert text from string builder like
StringBuilder buildAlertString=new StringBuilder();
buildAlertString.Append("You currently have an incomplete quote.");
buildAlertString.Append(Environment.NewLine);
buildAlertString.Append(string.Format("First Name:{0}",_firstName));
...
string alertText=buildAlertString.ToString()
This is much easier to read and format. Hope this helps
Upvotes: 2
Reputation: 414
Try:
Response.Write("<script language='javascript'>alert(' You currently have an incomplete quote.\\n Here is your customers information: \\n First Name: " + "FNAME" + " \\n Last Name: " + "LNAME"+ " \\n Number Of Drivers: " + 6 + " \\n Number Of Vehicles: " + 6 + " \\n Date Of Quote: " + "DATE" + " ');</script>");
Then Try:
Response.Write("<script language='javascript'>alert(' You currently have an incomplete quote.| Here is your customers information: | First Name: " + "FNAME" + " | Last Name: " + "LNAME"+ " | Number Of Drivers: " + 6 + " | Number Of Vehicles: " + 6 + " | Date Of Quote: " + "DATE" + " ');</script>");
Upvotes: 1