Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: Problem with Response.Write("<script>alert('" + errorMessage + "')

Reply
Thread Tools

Re: Problem with Response.Write("<script>alert('" + errorMessage + "')

 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      08-13-2004
What does the "View Source" look like when the page hits your browser?

I did notice you don't have a language defined for your script tag, and you
are missing your semi colon on your statement.

bill

"Vinny Vinn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I an developing in C# when i call the following script
> Response.Write("<script>alert('Entry is required')</script>");
> the alert box is displayed
>
> however when the error messge is added in as a varible, no alert box is
> displayed
> and i recieve no runtine error,
>
> string errorMessage = "Entry is required";
> Response.Write("<script>alert('" + errorMessage + "')</script>");
>
> Vinny
>
> it just seems as the code is not excuting.Why??
>
> Vinny
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmlubnkgVmlubg==?=
Guest
Posts: n/a
 
      08-13-2004
Willam,
Thank you for your response.
The language is defined in the header of the html file (as shown
below).However you mentioned that i am missing a semi colon in my
statement,where?
<HEAD>
<title>BasicInformation</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>

"William F. Robertson, Jr." wrote:

> What does the "View Source" look like when the page hits your browser?
>
> I did notice you don't have a language defined for your script tag, and you
> are missing your semi colon on your statement.
>
> bill
>
> "Vinny Vinn" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I an developing in C# when i call the following script
> > Response.Write("<script>alert('Entry is required')</script>");
> > the alert box is displayed
> >
> > however when the error messge is added in as a varible, no alert box is
> > displayed
> > and i recieve no runtine error,
> >
> > string errorMessage = "Entry is required";
> > Response.Write("<script>alert('" + errorMessage + "')</script>");
> >
> > Vinny
> >
> > it just seems as the code is not excuting.Why??
> >
> > Vinny
> >

>
>
>

 
Reply With Quote
 
 
 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      08-13-2004
By using Response.Write (instead of Page.RegisterStartUpScript() ), it will
write out the <script> tags before the <HEAD> tags gets sent to the browser.
The browser will try to process it before it knows exactly what to do with
it. I not saying this is you problem, just something I would suggest
fixing.

The semi-colon is missing at the end of your alert statement.

Response.Write( "<script
language=\"javascript\">\nalert('message');\n</script>\n" );

If this still doesn't help, post a snippet of your "View Source" that is
working correctly and is not.

HTH,

bill

"Vinny Vinn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Willam,
> Thank you for your response.
> The language is defined in the header of the html file (as shown
> below).However you mentioned that i am missing a semi colon in my
> statement,where?
> <HEAD>
> <title>BasicInformation</title>
> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
> <meta name="CODE_LANGUAGE" Content="C#">
> <meta name="vs_defaultClientScript" content="JavaScript">
> <meta name="vs_targetSchema"
> content="http://schemas.microsoft.com/intellisense/ie5">
> </HEAD>
>
> "William F. Robertson, Jr." wrote:
>
> > What does the "View Source" look like when the page hits your browser?
> >
> > I did notice you don't have a language defined for your script tag, and

you
> > are missing your semi colon on your statement.
> >
> > bill
> >
> > "Vinny Vinn" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I an developing in C# when i call the following script
> > > Response.Write("<script>alert('Entry is required')</script>");
> > > the alert box is displayed
> > >
> > > however when the error messge is added in as a varible, no alert box

is
> > > displayed
> > > and i recieve no runtine error,
> > >
> > > string errorMessage = "Entry is required";
> > > Response.Write("<script>alert('" + errorMessage + "')</script>");
> > >
> > > Vinny
> > >
> > > it just seems as the code is not excuting.Why??
> > >
> > > Vinny
> > >

> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IIS errormessage referrs non-existing linenumber Christina N ASP .Net 0 06-21-2004 11:17 AM
Reset errormessage on CustomValidator =?Utf-8?B?RG9ydGU=?= ASP .Net 1 05-07-2004 01:31 PM
The position of the validator errormessage Arjen ASP .Net 2 08-02-2003 11:44 AM
Errormessage in CustomValidator Edmilson ASP .Net 0 07-10-2003 12:56 PM
ErrorMessage Kenny ASP .Net 1 07-06-2003 12:13 AM



Advertisments