472,146 Members | 1,280 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

Displaying calculation result without reloading whole ASP page



I'm building an ASP page that has a lot of text and graphics.

There is a calculation facility on the page. The user enters several
numbers in a form and presses a button to see the calculated answer.

The problem is this: when the user presses the Calculate button, the
whole page is reloaded and, on a large page, this is very noticeable.

Is there any way that I can get the calculation done and the result
displayed without reloading the whole page?

A simplified version of the page "calctest.asp" is shown below.

<!-- ignore html on usenet
<html>
<head>
<title>
This is calctest.asp
</title>
</head>

<body>
<h1>This is the test page</h1>

There are a lot of words and graphics displayed here.

<%
Var1 = trim(Request.Form("VarA"))
Var2 = trim(Request.Form("VarB"))
Var3 = Var1 * Var2
%>

<FORM Name=Calculation Action=calctest.asp Method=Post>
<input type="text" name="VarA" size="2" value=<%=Var1%>>
&nbsp;
<input type="text" name="VarB" size="2" value=<%=Var2%>>
&nbsp;
<input type="text" name="VarC" size="3" value=<%=Var3%>>
&nbsp;
<INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
<p>
</FORM>

</body>
</html>
end ignore html on usenet -->
Jul 19 '05 #1
8 3900
If the calculation is simple and you do not care if the user sees the
algorithm, do the calculation in JavaScript and do not go back to the
server.

"Aspersion" <as*******@exasperated.btopenworld.com> wrote in message
news:be************@ID-13547.news.dfncis.de...


I'm building an ASP page that has a lot of text and graphics.

There is a calculation facility on the page. The user enters several
numbers in a form and presses a button to see the calculated answer.

The problem is this: when the user presses the Calculate button, the
whole page is reloaded and, on a large page, this is very noticeable.

Is there any way that I can get the calculation done and the result
displayed without reloading the whole page?

A simplified version of the page "calctest.asp" is shown below.

<!-- ignore html on usenet
<html>
<head>
<title>
This is calctest.asp
</title>
</head>

<body>
<h1>This is the test page</h1>

There are a lot of words and graphics displayed here.

<%
Var1 = trim(Request.Form("VarA"))
Var2 = trim(Request.Form("VarB"))
Var3 = Var1 * Var2
%>

<FORM Name=Calculation Action=calctest.asp Method=Post>
<input type="text" name="VarA" size="2" value=<%=Var1%>>
&nbsp;
<input type="text" name="VarB" size="2" value=<%=Var2%>>
&nbsp;
<input type="text" name="VarC" size="3" value=<%=Var3%>>
&nbsp;
<INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
<p>
</FORM>

</body>
</html>
end ignore html on usenet -->

Jul 19 '05 #2
On Sat, 5 Jul 2003 14:12:23 -0500, "Marvin Thompson"
<ma**@wavefront.com> wrote:
If the calculation is simple and you do not care if the user sees the
algorithm, do the calculation in JavaScript and do not go back to the
server.
Thanks, but I don't want the user to know how the calculation works.
As for JavaScript, not everyone uses it.
"Aspersion" <as*******@exasperated.btopenworld.com> wrote in message
news:be************@ID-13547.news.dfncis.de...


I'm building an ASP page that has a lot of text and graphics.

There is a calculation facility on the page. The user enters several
numbers in a form and presses a button to see the calculated answer.

The problem is this: when the user presses the Calculate button, the
whole page is reloaded and, on a large page, this is very noticeable.

Is there any way that I can get the calculation done and the result
displayed without reloading the whole page?

A simplified version of the page "calctest.asp" is shown below.

<!-- ignore html on usenet
<html>
<head>
<title>
This is calctest.asp
</title>
</head>

<body>
<h1>This is the test page</h1>

There are a lot of words and graphics displayed here.

<%
Var1 = trim(Request.Form("VarA"))
Var2 = trim(Request.Form("VarB"))
Var3 = Var1 * Var2
%>

<FORM Name=Calculation Action=calctest.asp Method=Post>
<input type="text" name="VarA" size="2" value=<%=Var1%>>
&nbsp;
<input type="text" name="VarB" size="2" value=<%=Var2%>>
&nbsp;
<input type="text" name="VarC" size="3" value=<%=Var3%>>
&nbsp;
<INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
<p>
</FORM>

</body>
</html>
end ignore html on usenet -->


Jul 19 '05 #3
OK, you can hide the algorithm with an include file. As for JavaScript,
only IE understands VBscript. All browsers understand JavaScript. All
client side scripting requires that you learn JavaScript. Server side
scripting can be VBscript. Good luck.
"Aspersion" <as*******@exasperated.btopenworld.com> wrote in message
news:be************@ID-13547.news.dfncis.de...
On Sat, 5 Jul 2003 14:12:23 -0500, "Marvin Thompson"
<ma**@wavefront.com> wrote:
If the calculation is simple and you do not care if the user sees the
algorithm, do the calculation in JavaScript and do not go back to the
server.


Thanks, but I don't want the user to know how the calculation works.
As for JavaScript, not everyone uses it.
"Aspersion" <as*******@exasperated.btopenworld.com> wrote in message
news:be************@ID-13547.news.dfncis.de...


I'm building an ASP page that has a lot of text and graphics.

There is a calculation facility on the page. The user enters several
numbers in a form and presses a button to see the calculated answer.

The problem is this: when the user presses the Calculate button, the
whole page is reloaded and, on a large page, this is very noticeable.

Is there any way that I can get the calculation done and the result
displayed without reloading the whole page?

A simplified version of the page "calctest.asp" is shown below.

<!-- ignore html on usenet
<html>
<head>
<title>
This is calctest.asp
</title>
</head>

<body>
<h1>This is the test page</h1>

There are a lot of words and graphics displayed here.

<%
Var1 = trim(Request.Form("VarA"))
Var2 = trim(Request.Form("VarB"))
Var3 = Var1 * Var2
%>

<FORM Name=Calculation Action=calctest.asp Method=Post>
<input type="text" name="VarA" size="2" value=<%=Var1%>>
&nbsp;
<input type="text" name="VarB" size="2" value=<%=Var2%>>
&nbsp;
<input type="text" name="VarC" size="3" value=<%=Var3%>>
&nbsp;
<INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
<p>
</FORM>

</body>
</html>
end ignore html on usenet -->

Jul 19 '05 #4
On Sat, 5 Jul 2003 23:20:28 -0500, "Marvin Thompson"
<ma**@wavefront.com> wrote:
OK, you can hide the algorithm with an include file. As for JavaScript,
only IE understands VBscript. All browsers understand JavaScript. All
client side scripting requires that you learn JavaScript. Server side
scripting can be VBscript. Good luck.
Thanks for the input. When I said that not everyone uses JavaScript, I
meant that some people, including me, have it disabled on their
machine for security purposes.

The reason I want to handle the whole process server side is so that
any client configuration will see the same website.

BTW, include files don't hide your client side code from the really
determined. If their computer can read it, they can read it.
"Aspersion" <as*******@exasperated.btopenworld.com> wrote in message
news:be************@ID-13547.news.dfncis.de...
On Sat, 5 Jul 2003 14:12:23 -0500, "Marvin Thompson"
<ma**@wavefront.com> wrote:
>If the calculation is simple and you do not care if the user sees the
>algorithm, do the calculation in JavaScript and do not go back to the
>server.


Thanks, but I don't want the user to know how the calculation works.
As for JavaScript, not everyone uses it.
>"Aspersion" <as*******@exasperated.btopenworld.com> wrote in message
>news:be************@ID-13547.news.dfncis.de...
>>
>>
>> I'm building an ASP page that has a lot of text and graphics.
>>
>> There is a calculation facility on the page. The user enters several
>> numbers in a form and presses a button to see the calculated answer.
>>
>> The problem is this: when the user presses the Calculate button, the
>> whole page is reloaded and, on a large page, this is very noticeable.
>>
>> Is there any way that I can get the calculation done and the result
>> displayed without reloading the whole page?
>>
>> A simplified version of the page "calctest.asp" is shown below.
>>
>> <!-- ignore html on usenet
>> <html>
>> <head>
>> <title>
>> This is calctest.asp
>> </title>
>> </head>
>>
>> <body>
>> <h1>This is the test page</h1>
>>
>> There are a lot of words and graphics displayed here.
>>
>> <%
>> Var1 = trim(Request.Form("VarA"))
>> Var2 = trim(Request.Form("VarB"))
>> Var3 = Var1 * Var2
>> %>
>>
>> <FORM Name=Calculation Action=calctest.asp Method=Post>
>> <input type="text" name="VarA" size="2" value=<%=Var1%>>
>> &nbsp;
>> <input type="text" name="VarB" size="2" value=<%=Var2%>>
>> &nbsp;
>> <input type="text" name="VarC" size="3" value=<%=Var3%>>
>> &nbsp;
>> <INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
>> <p>
>> </FORM>
>>
>> </body>
>> </html>
>> end ignore html on usenet -->
>


Jul 19 '05 #5
Aspersion wrote on 06 jul 2003 in
microsoft.public.inetserver.asp.general:
On 05 Jul 2003 20:01:29 GMT, "Evertjan." wrote:
Aspersion wrote on 05 jul 2003 :
Thanks, but I don't want the user to know how the calculation works.
As for JavaScript, not everyone uses it.
You can do this with concealed iframes, but you will need clientside
code to realize this.


Thanks, but I don't want any client side code. The whole process must
run on the server.


That is what I said. The proces runs on the server, but either you load a
new page everuy time or you use clientside code to load the output in a
concealed iframe and then using it on your initial page.

That is your choice
Some users disable JavaScript
You mean, I think, some users disable clientside code, this can be
javascript and [in IE] vbscript, just as serverside code can be in
javascript, vbscript, and many more.
and, besides, I don't want to make the code visible.
The code of your secret algorithm is not accessable, as it stays
serverside. only the code to enter the result on the clients screen
without a total refresh is clientside.
That leaves me with the original problem: how do I refresh a box on
the page to show a calculated result without having to re-send the
whole page?


Impossible without clientside scripting.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #6
On 06 Jul 2003 12:51:14 GMT, "Evertjan."
<ex**************@interxnl.net> wrote:

That is what I said. The proces runs on the server, but either you load a
new page everuy time or you use clientside code to load the output in a
concealed iframe and then using it on your initial page.


Iframes are limited. Like other frames, they're not very search engine
friendly. I'm also left with the client side code problem. You can't
depend on the client machine to run your code properly.
That leaves me with the original problem: how do I refresh a box on
the page to show a calculated result without having to re-send the
whole page?


Impossible without clientside scripting.


I thought that, but I was hoping somebody knew better.

Thanks for your thoughts.
Jul 19 '05 #7
Have you tried using Remote Scripting? The premise of this technology is
that it will do calculations without reloading the whole page. It's

tricky...you'll have to read the documentation on it carefully, (and it
doesn't work in Netscape) but, if you have a specific audience that uses

only IE it can be your answer.

Good luck,

Linda

"Aspersion" <as*******@exasperated.btopenworld.com> wrote in message
news:be************@ID-13547.news.dfncis.de...


I'm building an ASP page that has a lot of text and graphics.

There is a calculation facility on the page. The user enters several
numbers in a form and presses a button to see the calculated answer.

The problem is this: when the user presses the Calculate button, the
whole page is reloaded and, on a large page, this is very noticeable.

Is there any way that I can get the calculation done and the result
displayed without reloading the whole page?

A simplified version of the page "calctest.asp" is shown below.

<!-- ignore html on usenet
<html>
<head>
<title>
This is calctest.asp
</title>
</head>

<body>
<h1>This is the test page</h1>

There are a lot of words and graphics displayed here.

<%
Var1 = trim(Request.Form("VarA"))
Var2 = trim(Request.Form("VarB"))
Var3 = Var1 * Var2
%>

<FORM Name=Calculation Action=calctest.asp Method=Post>
<input type="text" name="VarA" size="2" value=<%=Var1%>>
&nbsp;
<input type="text" name="VarB" size="2" value=<%=Var2%>>
&nbsp;
<input type="text" name="VarC" size="3" value=<%=Var3%>>
&nbsp;
<INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
<p>
</FORM>

</body>
</html>
end ignore html on usenet -->

Jul 19 '05 #8
Another option is xmlhttp. I have a demo for this at
http://tinyurl.com/5luf. Scroll down to the dynamic listbox example.

Bob Barrows
Aspersion wrote:
I'm building an ASP page that has a lot of text and graphics.

There is a calculation facility on the page. The user enters several
numbers in a form and presses a button to see the calculated answer.

The problem is this: when the user presses the Calculate button, the
whole page is reloaded and, on a large page, this is very noticeable.

Is there any way that I can get the calculation done and the result
displayed without reloading the whole page?

A simplified version of the page "calctest.asp" is shown below.

<!-- ignore html on usenet
<html>
<head>
<title>
This is calctest.asp
</title>
</head>

<body>
<h1>This is the test page</h1>

There are a lot of words and graphics displayed here.

<%
Var1 = trim(Request.Form("VarA"))
Var2 = trim(Request.Form("VarB"))
Var3 = Var1 * Var2
%>

<FORM Name=Calculation Action=calctest.asp Method=Post>
<input type="text" name="VarA" size="2" value=<%=Var1%>>
&nbsp;
<input type="text" name="VarB" size="2" value=<%=Var2%>>
&nbsp;
<input type="text" name="VarC" size="3" value=<%=Var3%>>
&nbsp;
<INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
<p>
</FORM>

</body>
</html>
end ignore html on usenet -->

Jul 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by J. J. Cale | last post: by
5 posts views Thread by JStrauss | last post: by
3 posts views Thread by Richard | last post: by
54 posts views Thread by VK | last post: by
28 posts views Thread by beach.dk | last post: by
5 posts views Thread by =?Utf-8?B?amVsbGU3OQ==?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.