I have a button like
<asp:Button ID="Button1" runat="server" Text="Submit" onclick="RedirectToLocker"
OnClientClick="return false;" UseSubmitBehavior="false" />
and a method in the codebehind like
public void RedirectToLocker(object sender, EventArgs e)
{
Response.Redirect(ConfigurationManager.AppSettings["LockerLoginURL"]);
}
But when I click the button it doesn't hit the code in the method. If I remove OnClientClick = "return false;" then the button submits the form and goes to the wrong page. What am I doing wrong?
EDIT: I am using the OnClientClick="return false;" code because without it the button for some reason acts as a submit for the form it is nested in and immediately redirects to the form action url instead of hitting my code.