Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 How to verify string for javascript alert func?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

GoodMorningSky
Junior Member

122 Posts

Posted - 11 January 2006 :  21:55:13  Show Profile
In ASP.NET aspx page, I use following code.

private void ibtnAddNew_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
try{
// Do something
}
catch(Exception ex)
{
Response.Write("<script>alert(\""+ ex.Message +"\");</script>");
return;
}
}

Problem occurs ex.Message contains New Line character or other invalid characters such as ", ' or others..

Is there any method I can call and make sure string being passed alert doesn't throw javascript error when I show the message to user?

Any idea helps.

Software Engineer.
MCSD.NET, SCWCD
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07