Solved

Accessing a seperate class from another class

Posted on 2007-03-20
5
194 Views
Last Modified: 2011-09-20
This is a really easy question, but for some reason i cant seem to figure it out....

I have my Default.aspx page with the .cs code-behind that runs some methods. I also have another class in the App_Code folder called DataAccess.cs that has some public methods that i want to call in my Default.aspx.cs page, but i cant seem to access the class.

Any help?
0
Comment
Question by:dtddev
  • 3
  • 2
5 Comments
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 18759158
for instance methods:

DataAccess da = new DataAccess();
da.RunMethod();

for static methods:
DataAccess.RunStaticMethod();

make sure the class is declared public as well
0
 

Author Comment

by:dtddev
ID: 18759291
right the only problem is that when i Type in DataAccess, it does not come up in the Intellisense
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 18759303
Can you post the contests of DataAccess (or at least the class and method definitions - you don;t need to include the code within the methods)?
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 18759309
I'm thinking it's either a namespace issue or a visibility issue (is it "class DataAccess" or "public class DataAccess")
0
 

Author Comment

by:dtddev
ID: 18759341
AH HA. i figure it out.... wow i feel stupid. I named the class DataAccess.cs but the actuall class name was sqlDataAccess..........

Thanks for your help
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
asp.net mvc5 6 20
C# LINQ ForEach() question 6 48
asp.net web application 3 25
reading excel file in .net 2 12
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question