Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Display alert or messages to the user.

Reply
Thread Tools

Display alert or messages to the user.

 
 
Marge
Guest
Posts: n/a
 
      10-30-2008
This may be in the wrong forum, but here goes.

How can I display an alert in the users browser window from an asp page.

For example, a welcome message. I know I can do this with response.write,
but I'd like to have a general method of displaying messages to the user.

Thanks a lot all.


 
Reply With Quote
 
 
 
 
Marge
Guest
Posts: n/a
 
      10-30-2008
I meant to add this in the post. I've tried using this code, but nothing
happens:

<%
msg = "Just a Test Message"
Response.Write("<" & "script language=VBScript>")
Response.Write("MsgBox """ & msg & """<" & "/script>")
%>


"Marge" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This may be in the wrong forum, but here goes.
>
> How can I display an alert in the users browser window from an asp page.
>
> For example, a welcome message. I know I can do this with response.write,
> but I'd like to have a general method of displaying messages to the user.
>
> Thanks a lot all.
>
>



 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      10-30-2008
"Marge" <(E-Mail Removed)> wrote:

>I meant to add this in the post. I've tried using this code, but nothing
>happens:
>
><%
> msg = "Just a Test Message"
> Response.Write("<" & "script language=VBScript>")
> Response.Write("MsgBox """ & msg & """<" & "/script>")
>%


<%msg="Just a Test Message" %>
<script type="text/javascript">
alert("<%=msg%>");
</script>

--
Tim Slattery
MS MVP(Shell/User)
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      10-30-2008
Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:

> "Marge" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> This may be in the wrong forum, but here goes.
>>
>> How can I display an alert in the users browser window from an asp
>> page.
>>
>> For example, a welcome message. I know I can do this with
>> response.write, but I'd like to have a general method of displaying
>> messages to the user.


[Please do not toppost on usenet]

> I meant to add this in the post. I've tried using this code, but
> nothing happens:
>
> <%
> msg = "Just a Test Message"
> Response.Write("<" & "script language=VBScript>")
> Response.Write("MsgBox """ & msg & """<" & "/script>")
> %>


Your clientside vbscript, if it works, then only on IE.

Try:


message = "Hello world"
%>
<script type='text/javascript'>
alert('<% = message %>');
</script>
<%



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
Marge
Guest
Posts: n/a
 
      10-30-2008
Thanks Evertjan and Tim. I got no alert nor did I get any error message.
Here is a code fragment that I am using. Perhaps your keen eyes will see
where this little fool is messing up:

If UCase(strStatus) = "PENDING" Then

strMSG = "You must complete the following form!"

%>
<script type='text/javascript'>
alert('<% = strMSG %>');
</script>
<%

Response.redirect ("Acct_Profileedit.asp?ACCT_NO='" & strAcctNo &"'")

End if


"Evertjan." <(E-Mail Removed)> wrote in message
news:Xns9B47D75745A01eejj99@194.109.133.242...
> Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:
>
>> "Marge" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> This may be in the wrong forum, but here goes.
>>>
>>> How can I display an alert in the users browser window from an asp
>>> page.
>>>
>>> For example, a welcome message. I know I can do this with
>>> response.write, but I'd like to have a general method of displaying
>>> messages to the user.

>
> [Please do not toppost on usenet]
>
>> I meant to add this in the post. I've tried using this code, but
>> nothing happens:
>>
>> <%
>> msg = "Just a Test Message"
>> Response.Write("<" & "script language=VBScript>")
>> Response.Write("MsgBox """ & msg & """<" & "/script>")
>> %>

>
> Your clientside vbscript, if it works, then only on IE.
>
> Try:
>
>
> message = "Hello world"
> %>
> <script type='text/javascript'>
> alert('<% = message %>');
> </script>
> <%
>
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
>



 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      10-30-2008
Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:

[Please Please Please Please Please do not toppost on usenet]


> Thanks Evertjan and Tim. I got no alert nor did I get any error
> message. Here is a code fragment that I am using. Perhaps your keen
> eyes will see where this little fool is messing up:
>
> If UCase(strStatus) = "PENDING" Then
>
> strMSG = "You must complete the following form!"
>
> %>
> <script type='text/javascript'>
> alert('<% = strMSG %>');
> </script>
> <%
>
> Response.redirect ("Acct_Profileedit.asp?ACCT_NO='" & strAcctNo &"'")


[no reason to put single quotes in a querystring]

If you do a redirect, no clientside code is executed,
as the redirect command goes to the html header.

================================================
<%
If UCase(strStatus) = "PENDING" Then
strMSG = "You must complete the following form!"
redir = "Acct_Profileedit.asp?ACCT_NO=" & strAcctNo
%>
<script type='text/javascript'>
alert('<% = strMSG %>');
location.href = '<% = redir %>';
</script>
<%
response.end
End If
%>
==================================================

Perhaps some learing about the difference of
serverside vs clientside execution is required?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
Marge
Guest
Posts: n/a
 
      10-30-2008
Thanks Evertjan. I already tried the response.end.

Also, I left out the asp tags (<%) to avoid confusion. All the correct tags
are in place and my existing code works.

I was simply trying to show where I had placed your suggested code.
M
"Evertjan." <(E-Mail Removed)> wrote in message
news:Xns9B47E28E429B0eejj99@194.109.133.242...
> Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:
>
> [Please Please Please Please Please do not toppost on usenet]
>
>
>> Thanks Evertjan and Tim. I got no alert nor did I get any error
>> message. Here is a code fragment that I am using. Perhaps your keen
>> eyes will see where this little fool is messing up:
>>
>> If UCase(strStatus) = "PENDING" Then
>>
>> strMSG = "You must complete the following form!"
>>
>> %>
>> <script type='text/javascript'>
>> alert('<% = strMSG %>');
>> </script>
>> <%
>>
>> Response.redirect ("Acct_Profileedit.asp?ACCT_NO='" & strAcctNo &"'")

>
> [no reason to put single quotes in a querystring]
>
> If you do a redirect, no clientside code is executed,
> as the redirect command goes to the html header.
>
> ================================================
> <%
> If UCase(strStatus) = "PENDING" Then
> strMSG = "You must complete the following form!"
> redir = "Acct_Profileedit.asp?ACCT_NO=" & strAcctNo
> %>
> <script type='text/javascript'>
> alert('<% = strMSG %>');
> location.href = '<% = redir %>';
> </script>
> <%
> response.end
> End If
> %>
> ==================================================
>
> Perhaps some learing about the difference of
> serverside vs clientside execution is required?
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
>



 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      10-30-2008
Gazing into my crystal ball I observed "Marge" <(E-Mail Removed)> writing
in news:#(E-Mail Removed):

> Here is a code fragment that I am using. Perhaps your keen eyes will

see
> where this little fool is messing up:
>
> If UCase(strStatus) = "PENDING" Then
>
> strMSG = "You must complete the following form!"
>
> %>
><script type='text/javascript'>
> alert('<% = strMSG %>');
></script>
><%
>
> Response.redirect ("Acct_Profileedit.asp?ACCT_NO='" & strAcctNo &"'")
>
> End if
>
>


As others have said, any client side script will not execute with a
redirect.

Additionally, I hope that you are keeping the values that have already
been filled out when the user gets the form again. There is nothing
worse than filling out a long form, omitting one thing, and the script
comes back with all the previously filled fields blank. This is one of
the reasons I prefer to post to the same page.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      10-31-2008
Mark Rae [MVP] wrote on 31 okt 2008 in
microsoft.public.inetserver.asp.general:

> "Evertjan." <(E-Mail Removed)> wrote in message
> news:Xns9B47E28E429B0eejj99@194.109.133.242...
>
>> [Please Please Please Please Please do not toppost on usenet]

>
> Well said, though you are clearly wasting your time with Marge...


TNX. ;-}

Usuallly after this I cease responding.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
Jeff Dillon
Guest
Posts: n/a
 
      11-05-2008
"Evertjan." <(E-Mail Removed)> wrote in message
news:Xns9B4864E467A58eejj99@194.109.133.242...
> Mark Rae [MVP] wrote on 31 okt 2008 in
> microsoft.public.inetserver.asp.general:
>
>> "Evertjan." <(E-Mail Removed)> wrote in message
>> news:Xns9B47E28E429B0eejj99@194.109.133.242...
>>
>>> [Please Please Please Please Please do not toppost on usenet]

>>
>> Well said, though you are clearly wasting your time with Marge...

>
> TNX. ;-}
>
> Usuallly after this I cease responding.
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)


Stop being usenet police. Of all the articles I've read on top vs bottom
posting, yes, bottom posting is preferred. But it's user choice, and many
many people prefer top posting. Personally I've changed from top to bottom,
but not because of rude requests like yours. I prefer top.

YOU get a decent news reader that supports threaded discussions! Granted,
web based readers don't view top postings well. I know all this.

Ok, here comes. "this isn't email..blah blah blah". Take a chill pill. But
notice I bottom posted.


 
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
Alert..General Alert?..New Discovery?. =?Utf-8?B?U3BhbW1lcipLaWxsZXI=?= Wireless Networking 0 07-24-2007 03:36 PM
on click in popup window throws alert : need to avoid alert of postdata Ganesh ASP .Net 0 06-29-2007 06:51 AM
How to create a form Alert - Not using Alert Boxes Mersh Java 0 03-13-2007 04:14 PM
ALERT: Virus Scam Alert! Toronto Garage Door Company Computer Support 1 11-18-2003 04:16 PM
alert messages and deleting a datagrid row. Lauchlan M ASP .Net 2 08-26-2003 02:04 AM



Advertisments