Solved

Accessing a seperate class from another class

Posted on 2007-03-20
5
193 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

785 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