473,387 Members | 1,603 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,387 software developers and data experts.

Reference another file from code-behind page...?

Hey,

I'm sure this is an easy question for most.

I would like to create a class with a bunch of "library" functions...
But I'm not sure how I would configure it so that I can call functions
from one "code" file from another "code behind" file....

Page1.aspx ---Page1.aspx.cs ---globallibrary.cs

Is this possible?

Thanks!

Jun 9 '07 #1
7 2231
On Jun 9, 3:32 pm, Bodyboarder20 <ShieldsJa...@gmail.comwrote:
Hey,

I'm sure this is an easy question for most.

I would like to create a class with a bunch of "library" functions...
But I'm not sure how I would configure it so that I can call functions
from one "code" file from another "code behind" file....

Page1.aspx ---Page1.aspx.cs ---globallibrary.cs

Is this possible?

Thanks!
globallibrary_class_name.public_static_function_na me();

public class globallibrary_class_name
{
public static string public_static_function_name()
{
return "hello";
}
}

Jun 9 '07 #2
re:
!I would like to create a class with a bunch of "library" functions...
!But I'm not sure how I would configure it so that I can call functions
!from one "code" file from another "code behind" file....

Place globallibrary.cs in the App_Code directory.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Bodyboarder20" <Sh**********@gmail.comwrote in message
news:11*********************@g4g2000hsf.googlegrou ps.com...
Hey,

I'm sure this is an easy question for most.

I would like to create a class with a bunch of "library" functions...
But I'm not sure how I would configure it so that I can call functions
from one "code" file from another "code behind" file....

Page1.aspx ---Page1.aspx.cs ---globallibrary.cs

Is this possible?

Thanks!

Jun 9 '07 #3
Do I need to put any spacial tags at the top of the page1.aspx.cs file
to point it to the globallibrary.cs file?

Jun 9 '07 #4
Oh, btw... this is .NET 1.1 ( I know, my work is nuts )

!from one "code" file from another "code behind" file....

Place globallibrary.cs in the App_Code directory.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
======================================"Bodyboarder 20" <ShieldsJa...@gmail.comwrote in message

news:11*********************@g4g2000hsf.googlegrou ps.com...
Hey,
I'm sure this is an easy question for most.
I would like to create a class with a bunch of "library" functions...
But I'm not sure how I would configure it so that I can call functions
from one "code" file from another "code behind" file....
Page1.aspx ---Page1.aspx.cs ---globallibrary.cs
Is this possible?
Thanks!- Hide quoted text -

- Show quoted text -

Jun 9 '07 #5
For ASP.NET 1,1, compile the code from the command-line,
and import/reference the resulting assembly.

Open a command window and make sure the
1.1 .Net Framework directory is in your system path, by running

PATH= %PATH% & C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;

Substitute the correct drive letter if you're booting from a different drive.

Also, if you have a non-standard Windows install,
replace "windows" with your custom-named install directory.

To compile a single source code file, use :

csc /t:library /out:globallibrary.dll globallibrary.cs

To compile all .cs files in a directory to globallibrary.dll ,
use : csc /t:library /out:globallibrary.dll *.cs

If you need to reference a .Net Framework assembly or assemblies,
add them, separated by slashes :

csc /t:library /r:system.dll /r:system.data.dll /out:globallibrary.dll *.cs

Once you have compiled your assembly, place it in the /bin
directory of your application, and import your class Namespace in any aspx page:

<%@ Import Namespace="YourNameSpace" %>

If you're working with VS.NET, compile your assembly
as described and add a reference to it in your VS.NET project.

That will allow you to use Intellisense and get your
assembly's properties, methods, etc. when coding.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Bodyboarder20" <Sh**********@gmail.comwrote in message
news:11**********************@p47g2000hsd.googlegr oups.com...
Oh, btw... this is .NET 1.1 ( I know, my work is nuts )

!from one "code" file from another "code behind" file....

Place globallibrary.cs in the App_Code directory.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
======================================"Bodyboarder 20" <ShieldsJa...@gmail.comwrote in message

news:11*********************@g4g2000hsf.googlegrou ps.com...
Hey,
I'm sure this is an easy question for most.
I would like to create a class with a bunch of "library" functions...
But I'm not sure how I would configure it so that I can call functions
from one "code" file from another "code behind" file....
Page1.aspx ---Page1.aspx.cs ---globallibrary.cs
Is this possible?
Thanks!- Hide quoted text -

- Show quoted text -

Jun 9 '07 #6

Perfect solution!!!

Thanks so much!!!!!!!

Jun 9 '07 #7
re:
!Perfect solution!!!

Except that I fudged the path to the 1.1 Framework directory...

That should have been :

PATH= %PATH%;C:\WINDOWS\Microsoft.NET\Framework\v1.1.432 2;

Sorry...

Other than that, everything stands...and you're quite welcome.

:-)


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Bodyboarder20" <Sh**********@gmail.comwrote in message
news:11**********************@n4g2000hsb.googlegro ups.com...
>
Perfect solution!!!
Thanks so much!!!!!!!

Jun 9 '07 #8

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

Similar topics

7
by: Pablo J Royo | last post by:
Hello: i have a function that reads a file as an argument and returns a reference to an object that contains some information obtained from the file: FData &ReadFile(string FilePath); But ,...
6
by: trexim | last post by:
Hi, I am trying to create a Web Reference for CSTA using the URL http://www.ecma-international.org/standards/ecma-348/csta-wsdl/csta-wsdl-all-operations.wsdl Visual .Net complains that: "...
10
by: PCHOME | last post by:
Hi! Would someone please help me thess C error(in gcc on Linux)? The compiler continues to give me: readLP.o: In function `Input_Problem': readLP.o(.text+0x0): multiple definition of...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
0
balabaster
by: balabaster | last post by:
Hi all, I'm creating a class factory and a bunch of adapters to allow in house applications to communicate with mobile applications over different cellular networks. I've got my class...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.