1. set the PostBackUrl property of the Button to the New Page
<asp:button id="Button1" runat="server" text="test now " postbackurl="~/Default5.aspx" xmlns:asp="#unknown" />
or you can use
<asp:Button ID="Button1" runat="server" Text="test now "
onclick="Button1_Click2" />
code behind
protected void Button1_Click2(object sender, EventArgs e)
{
Server.Transfer("Default5.aspx");
}
Note : Response.Redirect("Default5.aspx"); will raise
Error Object reference not set to an instance of an object.
in the the other page
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Button btn = ((Button)PreviousPage.FindControl("Button1"));
Button1.Text = btn.Text;
}
}