Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

In my application i am having 2 different .aspx pages. I just want to call subroutine

In my page1.aspx.vb page from page2.aspx.vb

How can I do that?

Thanks & regards
Yogesh
Posted
Updated 3-Feb-11 23:51pm
v2
Comments
Rob Branaghan 4-Feb-11 5:48am    
Could you move the function / subroutine to a helper class and call it with both pages from there?
Ankur\m/ 4-Feb-11 5:53am    
Minor Edit Note: Added ASP.NET tag and minor spelling edit.

Create a Class, say Common.vb and put it inside App_Code folder of your ASP.NET application. Add that method inside this class. It will be available to all the web pages.
 
Share this answer
 
v2
Hi,

One aspx.cs/vb code behind class public method you can not access other aspx.cs/vb code behind class. below code is one aspx.cs/vb file method is public

If you want access common method for both aspx.vb/cs classes you can use for Separate class in App_code folder.create object of that class and you can access where ever you want.common class example.in App_code folder. this method.

C#
public class Common
{
    public Common()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public string  Hello()
    {
        return "Hello India";
    }
}
public partial class CustomeControl : System.Web.UI.Page
{
 Common com = new Common();
         com.Hello();
}
 
Share this answer
 
v2
Comments
Sandeep Mewara 4-Feb-11 6:46am    
It's PRE tag. :)

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