Cleavis
asked on
Stringbuilder Alert Box
We are using Stringbuilder to create a Javascript alert box to display data to our users.
The following code works when I run the app in IE6 but not in IE7.
Does anybody have a solution for this issue?
Thanks!
Chris
DclFld sb1 Type( StringBuilder ) New( 128 )
DclFld Message Type( *String )
Message = "THIS IS A TEST"
sb1.Append( Environment.NewLine + "<script language=javascript>" + Environment.NewLine)
sb1.Append( " alert('" + Message + "'); " + Environment.NewLine)
sb1.Append( "</script>" + Environment.NewLine )
*this.Page.RegisterStartup Script( "Alert", sb1.ToString() )
The following code works when I run the app in IE6 but not in IE7.
Does anybody have a solution for this issue?
Thanks!
Chris
DclFld sb1 Type( StringBuilder ) New( 128 )
DclFld Message Type( *String )
Message = "THIS IS A TEST"
sb1.Append( Environment.NewLine + "<script language=javascript>" + Environment.NewLine)
sb1.Append( " alert('" + Message + "'); " + Environment.NewLine)
sb1.Append( "</script>" + Environment.NewLine )
*this.Page.RegisterStartup
by the way, exactly what do you have as your StringBuilder definition. The one I see from here (http://www.codeproject.com/jscript/stringbuilder.asp) has "toString()" defined, but not "ToString()".
ASKER
I could not get the alert box to display in IE7 but it did in IE6... I have corrected this with the following.
Page.ClientScript.Register StartupScr ipt(*typeo f(*String) ,'Alert',' alert("' + sb1.ToString() + '")',*true)
This appears to be working properly.
Page.ClientScript.Register
This appears to be working properly.
Good. Glad to hear it.
That sounds like a .NET thing, rather than a StringBuilder thing though.
That sounds like a .NET thing, rather than a StringBuilder thing though.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
is it the StringBuilder code, or the .net stuff used to write the StringBuilder script code?
When you "view source" on IE6 and IE7, are they identical?
If so, remove the .NET code from the equation, and have a simple HTML + JavaScript page that works on IE6, but fails on IE7.