Click here to Skip to main content
16,017,037 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have class1.cs in App_Code and i want to use this class property in another place.
Posted

Have a look at below link. I hope it should clear your doubts regarding "Object Oriented Programming".

Object Oriented Programming Fundamentals

Edited -
It's always better to start from basics.

Also its really bad, Same Person asking same Question multiple times within span of less than 1/2 Hour.

It's shows disrespect towards the people who has Answered your previous Question on the same Topic.

If you are not clear with the Answer then you should discuss with the Solution Provider their it self, instead of posting same Question again.
 
Share this answer
 
v2
Comments
raj_sagoo 2-Sep-11 3:58am    
great thanks.
Could you please elaborate "another place"? I am assuming you mean "other project".

App_code classes are public and can be used anywhere within web project.
If you want to use the class outside web project (in other project in your solution) then move the class into a separate class library project and reference it wherever you need the class (web project or the other project).
 
Share this answer
 
You have already had an answer to this when you posted it twenty minutes ago: how to call class1.cs class on page[^]

To reiterate Abhinav's response:

If you have created a class called class1 in you App_code folder, then in your page.cs all you have to do is declare an instance of class1 and use it as normal. Alternatively, as Abhinav said, you could declare static methods and properties and use those directly, just as you would with an other class.

Why is this giving you a problem?
Use the "Reply" feature below this answer to respond - do not create a new question.
 
Share this answer
 
Hey, are you going to learn OOP basics and C# language by asking a billion of questions? You should create class1 instance, say object c1, in another place, and call your property, say Property1, in a manner c1.Property1; .
If you now feel that you you don't know how to create a class instance, PLEASE, don't post this question here. Read some info, learn about OOP and C#, it's really worth it if you're going to be a programmer :). If you don't know the basics (and by your questions I assume you don't), you'll encounter a lot of questions, and posting them here in thousands will hardly help you
 
Share this answer
 
Comments
raj_sagoo 2-Sep-11 3:52am    
thanks i started with Asp.net using C# a month ago so i am studying.can you guide me from where to start with and on what point i should give stress.
Timberbird 2-Sep-11 4:14am    
Start with object-oriented programming basics (for example use materials from the link given to you below). For C# I'd recommend Jeffrey Richter's "CLR via C#" and for ASP.NET books by Matthew MacDonald

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900