473,395 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Calling a Block of ASP from Another

I have a block of ASP code (enclosed in <% .. %>).

How can I call that piece of code from another piece of similar code?

And can the code be in any order on the page for it to work?

Thanks
Jul 19 '05 #1
3 1365
Keith wrote on 22 jun 2004 in microsoft.public.inetserver.asp.general:
I have a block of ASP code (enclosed in <% .. %>).

How can I call that piece of code from another piece of similar code?
You cannot "call" asp code.

Asp is only a platform for serverside programmlanguage codes.

Depending on the language used [jscript, vbscript, etc]
you van "call" a function in such code.
And can the code be in any order on the page for it to work?


Again that depends on the language used.
In general, functions can be declared in any order.
But main code has an order.

Example in Jscript:

<%@Language=jscript%>

<%
var t="hello world";
%>

<%
Response.write(t);
%>

Exchanging the order of these last two gives an error ;-)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2
Make it a function and use the "include" directive to make this function
available in another script.

My personal preference :
- is to include only files containg functions (so that all includes are done
at the beginning and I'm able to call the function later rather than being
forced to include the file where I want to "call" its code)
- is to have a main include file that takes care itself to include what is
needed in most pages (db, ui, or whatever else helper code). The current
page then includes the main include file and then those who stores rarely
used code.

Patrice

--

"Keith" <@.> a écrit dans le message de
news:OO**************@TK2MSFTNGP09.phx.gbl...
I have a block of ASP code (enclosed in <% .. %>).

How can I call that piece of code from another piece of similar code?

And can the code be in any order on the page for it to work?

Thanks

Jul 19 '05 #3
Do you mean something like this........?

<%
SomethingOrOther = GimmeTheString
Response.Write SomethingOrOther

Function GimmeTheString()
GimmeTheString = "don't you just love it when things work as they
should?"
End Function
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Keith" <@.> wrote in message news:OO**************@TK2MSFTNGP09.phx.gbl...
I have a block of ASP code (enclosed in <% .. %>).

How can I call that piece of code from another piece of similar code?

And can the code be in any order on the page for it to work?

Thanks

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Marina | last post by:
Hi, we have an app, that executes jobs submitted from an outside application. It executes them asynchronusly, by creating a delegate to the method that can run the job, and calling BeginInvoke on...
5
by: Joseph | last post by:
Hello, I have a C# program that builds a txt file and then, calls an external exe (this external exe simply imports this txt file into a DBF (DBase) file. (we copy a template of the DBF file into...
1
by: terrencel | last post by:
I was told to look at some old C code that was ported to C++. One of the file is like: ========================================= CPPClass* someCPPVar = NULL; extern "C" {
14
by: ericellsworth | last post by:
Hi, I'm trying to use a class to pass variables back and forth from a form opened in dialog mode. I have created a class which invokes a form in its show method, like so: Public Sub Show() '...
15
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that...
7
by: JJ | last post by:
Hi, I call a class in my windows service app and in that class I access a method that returns an OleDbReader. Now It does have records in the reader when I step through the method but when I...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
6
by: Marlene Arauz Martin | last post by:
Hello, How's everybody??? I have an aspx. page that is calling an executable,....like this... System.Diagnostics.ProcessStartInfo psi= new System.Diagnostics.ProcessStartInfo();...
6
by: Alex | last post by:
Hi... I have a stored procedure that takes in a large number of parameters (around 30) and returns (as output parameters) another 10 or so. At the moment, each parameter is declared, defined...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.