Solved

Accessing a seperate class from another class

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now