473,804 Members | 2,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1385
Keith wrote on 22 jun 2004 in microsoft.publi c.inetserver.as p.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 programmlanguag e 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=jsc ript%>

<%
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******** ******@TK2MSFTN GP09.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........?

<%
SomethingOrOthe r = GimmeTheString
Response.Write SomethingOrOthe r

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******** ******@TK2MSFTN GP09.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
368
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 the method. Throughout the job itself, we use the CallContext class to store information that is needed by many classes in the call stream. This works well, and concurrent threads are working fine. What happens is, that after a job is done,...
5
6127
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 the process folder where the exe lies and then this clipper EXE does the data move from the txt file to the DBF file). This process works fine on at least 3 PCs (Win 2K Pro and Win XP Pro) - irrespective of whether I schedule the process or...
1
2653
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
3015
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() ' This method shows the form used to get the info If sWhereInt = "" Then DoCmd.OpenForm sFormNameInt, acNormal, , , acFormAdd, _
15
11791
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 performs the query is contained in a delegate function that I execute via a second thread. On 1 or 2 of the 600+ servers the query hangs. I've tried to use Thread.Join() coupled with a Thread.Abort() but this does not kill the thread. Based on...
7
2031
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 return to calling class the OleDbReader dr is null. What am I missing here? Class1 calls Class2.Method which returns a OleDbReader. Class1's OleDbReader is null.
5
3446
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 5), but fails on IIS 6 running on a Win2003 server. The web uses Pages derived from a custom class I wrote (which itself derives from Page) to provide some common functionality. The Page_Load handler the failing webpage starts out like this: ...
6
1904
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(); psi.FileName="RATE2.exe";
6
2567
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 and added in my C# code as follows: SqlParameter prmCustAcctID = cmd.CreateParameter(); prmCustAcctID.ParameterName = "@CustAcctID";
0
9715
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10352
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10097
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7642
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.