Click here to Skip to main content
16,014,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai to all,

Please some one answer for my question..
Posted

You just need to create the object of that class something like this:

in .cs:
C#
class Alpha
{
  public string mymethod(string name)
 {
   return name;
 }
//if you have static method
  public static int mysecondmethod(int age)
 {
   return age;
 }

}


in .aspx.cs:

C#
Alpha obj=new Alpha();

obj.mymethod("ABC");
Alpha.mysecondmethod(20);


hope it helps :)
 
Share this answer
 
If you mean call a method in a .CS file from a ASPX.CS file, then just put the .CS file in your App_Code folder, and
refer to the static methods by classname:
C#
string s = MyClass.StaticMethod();

Or create an instance of the class and use the methods on the instance:
C#
MyClass inst = new MyClass();
string s = inst.Method();


If that isn't what you want to do, then please try to explain more clearly what you are trying to achieve.
 
Share this answer
 

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