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

codebehind and custom objects


Say I have a code behind class, and in that I want to instantiate and call
methods on some objects Ive written in other cs files, what do I need to do
to make those objects available within the codebehind?

thanks in advance
Nov 18 '05 #1
5 1032
Karl,

Add an assembly reference (if they're not in the current assembly) and add
the namespace with a using command.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Karl Hungus" <nn*********@hotmail.com> wrote in message
news:OH****************@twister.nyc.rr.com...

Say I have a code behind class, and in that I want to instantiate and call
methods on some objects Ive written in other cs files, what do I need to do to make those objects available within the codebehind?

thanks in advance

Nov 18 '05 #2
IF it is in the same assembly you can just Instantiate the class and call
its methods. If not you must a reference to the assembly and add an imports
or includes statement in the codebehind class

"Karl Hungus" <nn*********@hotmail.com> wrote in message
news:OH****************@twister.nyc.rr.com...

Say I have a code behind class, and in that I want to instantiate and call
methods on some objects Ive written in other cs files, what do I need to do to make those objects available within the codebehind?

thanks in advance

Nov 18 '05 #3

Forgive me, Im new to asp.net - Does this mean I need to compile my custom
classes into dlls?

where do I add an assembly reference?

thanks in advance,
Karl

"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Karl,

Add an assembly reference (if they're not in the current assembly) and add
the namespace with a using command.

+++ Rick ---

Nov 18 '05 #4

If they are in the same project/binary file you can just instantiate them.
If they are not then you need to reference the assembly (DLL).

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Karl Hungus" <nn*********@hotmail.com> wrote in message
news:vY****************@twister.nyc.rr.com...

Forgive me, Im new to asp.net - Does this mean I need to compile my custom
classes into dlls?

where do I add an assembly reference?

thanks in advance,
Karl

"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Karl,

Add an assembly reference (if they're not in the current assembly) and add the namespace with a using command.

+++ Rick ---


Nov 18 '05 #5

Is this something that is possible to do if you
A. dont use visual studio
and
B. have a shared hosting account?

"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...

If they are in the same project/binary file you can just instantiate them.
If they are not then you need to reference the assembly (DLL).

Nov 18 '05 #6

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

Similar topics

4
by: Boban Dragojlovic | last post by:
I create a new webform (I always use codebehind), and I insert some server-side controls into the form (the ASPX) Later, I switch to codeview, and I notice that some (sometimes all) of the...
12
by: A.M | last post by:
Hi, Using VS.NET 2003, If i use SRC page attribute instead of CodeBehind, do i still have intelisence and generally IDE support for that? Thanks, Ali
12
by: Karl Hungus | last post by:
If I use a code behind class for an aspx page, what is the best way to get data from the codebehind class into my aspx page? I know about databinding, but is there a more basic way of just...
2
by: MAG | last post by:
Hi, After using an assembly compiled into a DLL and added to the assembly cache for several months, we decided that it was too much trouble to maintain because of all the steps involved with...
7
by: dw | last post by:
Hello, all. I created a few Label objects, and deleted some. However, later when I was using the codebehind page in VS .NET 2003 to set the Text of the existing labels, I noticed that when I hit...
0
by: N. Demos | last post by:
Hello, I have a custom usercontrol, of which I have two instances of in my aspx page. Both the usercontrol and page have codebehind. In the page codebehind, I want a member variable for each...
2
by: landers | last post by:
Hi All, I have created a vb file that inherits a System.Web.UI.Page. As I am against duplicating source code, I have set the Codebehind attribute on all my aspx pages in the same directory. ...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
7
by: Chris | last post by:
When I create a new aspx page, VS automatically creates the assocaited codebehind file also. Is there a way to specifiy what goes in that codebehind file by default? I mean, if I wanted to see a...
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...
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.