I tried use your code and it gave me error message: CS1010: Newline in constant Source Error: Line 185: str.Append(""); I think the error came because I tried to use it inside my C# script: if (Common.RemoveSpecialCharacters(txtOrg.Text).Equals("")) { StringBuilder str = new StringBuilder(); str.Append(""); str.Append("alert('Please enter a valid organization name.')"); str.Append(""); RegisterStartupScript("Msg",str.ToString()); //lError.Text = "Please enter a valid organization name."; //return; } Any more help please? Thanks MY