Pages

Executing one ASP.NET Page from Another

Very recently i faced one problem where i want to execute one ASP.NET Page from Another Page just by calling inside some Function. Let we take this Scenario.

I have changed my code to dummy code as i cant write my real code here due to Copyright Violation. First i will discuss about that Problem.

Consider there are two ASP.NET Pages, Page1.aspx and Page2.aspx

Page1.aspx :
protected void Page_Load(object sender,EventArgs e)

{

Function1();

Function2();

Function3();

}

protected void Function1()

{

Response.Write("Function1");

}

protected void Function2()

{

Response.Write("Function2");

//Call Page2.aspx

}

protected void Function3()

{

Response.Write("Function3");

}
Page2.aspx:
protected void Page_Load(object sender,EventArgs e)

{

Response.Write("Page2");

}
Now we need result like this,

Output:
Function1

Function2

Page2

Function3
How will you do this?

0 comments:

Post a Comment