Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > client side asp within server side asp

Reply
Thread Tools

client side asp within server side asp

 
 
JT
Guest
Posts: n/a
 
      09-09-2004
im trying to use the following code to log whenever a user clicks through
this particlular message box - however, this currently logs regardless of
whether or not the message box was clicked - im assuming this is because the
server-side code can't see the client side if condition. but how can i set
the varMsgBox variable as a server-side variable?

<!--switch to client-side VBScript to use the MsgBox-->
<script language="VBSCRIPT">
dim varMsgBox
varMsgBox = "0"
varMsgBox = MsgBox ("<%=pop_up_text%>", 16, "Urgent Message")
'log that user clicked through the pop-up message - switch back to
server-side to call function to insert log message into the db
if varMsgBox = "1" then
<% Call dumplogfile("User clicked through the pop-up message: " &
pop_up_text)%>
end if
</script>


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      09-09-2004
JT wrote:
> im trying to use the following code to log whenever a user clicks
> through this particlular message box - however, this currently logs
> regardless of whether or not the message box was clicked - im
> assuming this is because the server-side code can't see the client
> side if condition. but how can i set the varMsgBox variable as a
> server-side variable?
>

You can't. All server-side code runs before client-side code is processed.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
 
JT
Guest
Posts: n/a
 
      09-09-2004
but isn't there a way to somehow do it along the lines of what is discussed
in this article?

http://www.aspfaq.com/show.asp?id=2198


"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> JT wrote:
> > im trying to use the following code to log whenever a user clicks
> > through this particlular message box - however, this currently logs
> > regardless of whether or not the message box was clicked - im
> > assuming this is because the server-side code can't see the client
> > side if condition. but how can i set the varMsgBox variable as a
> > server-side variable?
> >

> You can't. All server-side code runs before client-side code is processed.
>
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>



 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      09-09-2004
No, because by the time the message box comes up, control has switched to
the client.

Bob Lehmann

"JT" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> but isn't there a way to somehow do it along the lines of what is

discussed
> in this article?
>
> http://www.aspfaq.com/show.asp?id=2198
>
>
> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > JT wrote:
> > > im trying to use the following code to log whenever a user clicks
> > > through this particlular message box - however, this currently logs
> > > regardless of whether or not the message box was clicked - im
> > > assuming this is because the server-side code can't see the client
> > > side if condition. but how can i set the varMsgBox variable as a
> > > server-side variable?
> > >

> > You can't. All server-side code runs before client-side code is

processed.
> >
> >
> > --
> > Microsoft MVP -- ASP/ASP.NET
> > Please reply to the newsgroup. The email account listed in my From
> > header is my spam trap, so I don't check it very often. You will get a
> > quicker response by posting to the newsgroup.
> >
> >

>
>



 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      09-09-2004
No, that article talks about what you've successfully done: cause a
client-side action from from server-side code. It's a one-way street. Data
can only be passed to server-side code via the Request object, which only
exists when the page is initially called.

To do what you want will involve another page.

Bob Barrows

JT wrote:
> but isn't there a way to somehow do it along the lines of what is
> discussed in this article?
>
> http://www.aspfaq.com/show.asp?id=2198
>
>
> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> JT wrote:
>>> im trying to use the following code to log whenever a user clicks
>>> through this particlular message box - however, this currently logs
>>> regardless of whether or not the message box was clicked - im
>>> assuming this is because the server-side code can't see the client
>>> side if condition. but how can i set the varMsgBox variable as a
>>> server-side variable?
>>>

>> You can't. All server-side code runs before client-side code is
>> processed.
>>
>>
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get
>> a quicker response by posting to the newsgroup.


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      09-09-2004
1. With your particular example, will the response from your msgbox ever be
anything but 1? You don't leave the user many options when you have only
"vbOK"

2. Since your usage of VBScript in the browser already indicates you are
into doing things in an unorthodox way (said with a "<g>" of course!), you
could do something like so:

yourpage.asp:

<%
Dim pop_up_text
pop_up_text = "All your base are belong to us"
%>
<img id="x" style="display:none;" />

<script type="text/javascript">
//sorry, I cannot bring myself to use vbscript,

if(confirm('<%=pop_up_text%>')) {
var o = document.getElementById('x');
x.src =
'./process.asp?user=IdentifiedSomehow&m=<%=Server.URL Encode(pop_up_text)%>';
}
</script>



process.asp:

<%
Dim sUser, sMessage, oCDO
sUser = Request.Querystring("user")
sMessage = Request.Querystring("m")
Set oCDO = CreateObject("CDO.Message")
oCDO.From = "(E-Mail Removed)"
oCDO.To = "(E-Mail Removed)"
oCDO.Subject = "User clicked OK"
oCDO.TextBody = sUser & " clicked OK to a prompt of " & sMessage
oCDO.Send
Set oCDO = Nothing
%>




Ray at work





"JT" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> but isn't there a way to somehow do it along the lines of what is
> discussed
> in this article?
>
> http://www.aspfaq.com/show.asp?id=2198
>
>
> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> JT wrote:
>> > im trying to use the following code to log whenever a user clicks
>> > through this particlular message box - however, this currently logs
>> > regardless of whether or not the message box was clicked - im
>> > assuming this is because the server-side code can't see the client
>> > side if condition. but how can i set the varMsgBox variable as a
>> > server-side variable?
>> >

>> You can't. All server-side code runs before client-side code is
>> processed.
>>
>>
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get a
>> quicker response by posting to the newsgroup.
>>
>>

>
>



 
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
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
client-side browser timeout OR server-side web server timeout?? (please help) jrefactors@hotmail.com HTML 1 01-04-2005 06:13 AM
client-side browser timeout OR server-side web server timeout?? (please help) jrefactors@hotmail.com Javascript 0 01-04-2005 04:06 AM
client-side browser timeout OR server-side web server timeout?? (please help) jrefactors@hotmail.com Java 0 01-04-2005 04:06 AM
client-side versus server-side code in ASP.NET Matt ASP .Net 2 11-03-2003 08:39 AM



Advertisments