Programically envoking a Post Back Activitiy

P

Paul Perot

Hi All:

I was wondering if it was possible to evoke a post back event during code
execution. I have a form that contains file specific information. I would
like to iterate through an array of files and have the information on each
file posted and displayed on my form as I pragmatically manipulate that file
data. I know that this simple task should easily be done.... It is just a
matter of how. Do I need the server side code behind to execute some
jscript code at the appropriate point in server code execution? If so what
might that be? Right now I have a HTML Submit Button that I send a click
event to with some Jscript. It appears to be working but only seems to fire
at the end of the server code execution. Does anyone have a reason why? any
ideas of what to do better? or some steps that I may have missed? TIA for
all your help.

--

Best regards

Paul Perot
President
Perot Solutions
(e-mail address removed)
(770) 565 - 9151
(678) 852 - 7789 (c)
 
C

Chris Jackson

Well, form.submit from JavaScript will handle it. You have to keep in mind
that you have code executing in two places: on the server, and on the
client. The server side code won't post anything (and doesn't need to - you
are already at the server), and the client doesn't actually have code to
execute until the server side code has finished and spat out the DHTML that
the client can read and act on.
 
P

Paul Perot

Hi Chris:

Thank you for your response...I don't know if I explained what I wanted to
do as much as I explained what I did. What I would like is a mechanism to
update the data on my web page as the server side code cycles through a
number of files. For instance, if I read in a file, I post a thumbnail
image of the file, various office properties and some other items about that
file. I want that information to be displayed on the client, while the
server manipulates information on that file...when the server is done with
its manipulation, it selects the next file from the array, I would like that
information and picture displayed at that point on the browser... this would
repeat for several hundred files... is this possible... ?? or do you have
a better suggestion on how to do this?? TIA



Best regards

Paul Perot
President
Perot Solutions
(e-mail address removed)
(770) 565 - 9151
(678) 852 - 7789 (c)


Best regards

Paul Perot
President
Perot Solutions
(e-mail address removed)
(770) 565 - 9151
(678) 852 - 7789 (c)
 
C

Chris Jackson

You can flush the current contents of the Response buffer using the
HttpResponse.Flush method, so it is possible to flush the contents to the
browser, which can display a page before it is loaded. So, you can
selectively display as you process, and then just flush the response buffer
as you go along.
 
P

Paul Perot

Thanks Chris ...

I will look into this... I am assuming that the client side will see the new
images and data as I go along??? That is my main goal here. Will let you
know how this works out... thanks again

--

Best regards

Paul Perot
President
Perot Solutions
(e-mail address removed)
(770) 565 - 9151
(678) 852 - 7789 (c)
 
P

Paul Perot

Hi Chris.

I put in a Response.Flush() as you suggested..... but while that sent the
contents of the buffer to the client... it also stopped all server side
execution. Is this what it was meant to do? If so this is not what I
need... on the other hand I suspect I am just missing something else here.
The question is what? Any further ideas. Thanks

--

Best regards

Paul Perot
President
Perot Solutions
(e-mail address removed)
(770) 565 - 9151
(678) 852 - 7789 (c)
 
R

Randy Weber

I struggled with this for awhile and found the answer. It worked ONLY
if I had:

1) included the tag <meta http-equiv="Content-Type"
content="text/html; charset=windows-1252"> inside the <HTML><Head>
tags

2) used Repsonse.Buffer = True

3) inside the <body> tag was response.write "..." and response.flush

Randy
Below is a timer/pause sample:

<%
response.buffer = True
response.Clear
Dim sTime, i, elap, Pause, prev, max
sTime = Now()
Pause = request("pause")
If Not IsNumeric(Pause) Then Pause = 0
max = 500000
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>


<body>
<form action="pause.asp">
Pause (seconds): <input type=text name=pause
value="<%=request("pause")%>"><input type=submit></form>
<%
response.write "Pause: " & Pause & " Elap: " & elap & "<BR>"
Do
elap = DateDiff("s", sTime, Now())
If prev <> elap Then
response.flush
response.write "Pause: " & Pause & " Elap: " & elap & "<BR>"
End If
i = i + 1
If i > max Then Exit Do 'to avoid getting stuck in a loop
prev = elap
Loop Until CInt(elap) >= CInt(Pause)
response.write "<BR>Start: " & sTime & " End: " & Now() & " Elapsed: "
& elap & " Loop: " & i & "<BR>"
%>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top