<form id="form1" action="Detail.aspx" runat="server">
<input type="submit" id="save" name="Submit" value="Save and Add"/>
<asp:Button ID="Exit" runat="server" Text="Exit" onclick="Exit_Click" />
</form>
CodeBehind
protected void Exit_Click(object sender, EventArgs e)
{
Response.Redirect("Show.aspx");
}
When I click the Exit Button the response is not going to Show.aspx.It goes to Details.aspx.I am unable to understand why the control is not passing to Show.aspx;
I have added a new page to my site that matches what you are describing, and it seems to work exactly as you wish it to:
In the code behind:
In the markup:
If i click “Save and Add” button then i remain on the same page (Details.aspx) and i see the text “If this text is visible then it works…”
If i click the “Exit” button then i am taken to a page called Show.aspx
Be sure that you have AutoEventWireup=”true” in the top of your aspx page. This might be why you are not hitting the Exit_Click handler.
I hope this helps