Here is my html code
<form runat="server">
Hello, i'm login page
Enter Name <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<input type="submit" value="PressMe" onclick="location.href='<%: Url.Action("EnterLogin", "LoginForm") %>'" />
</form>
Here is my controller code
public class LoginFormController : Controller
{
public ActionResult ShowLogin()
{
return View();
}
public ActionResult EnterLogin()
{
ViewData["Name"] = Convert.ToString(Request.Form["txtName"]);
return View("EnterLogin");
}
}
On clicking PressMe button the expected output is to display Enter Login View but it doesn’t.If i double click on the button then it works fine.
Any reason for single click not to work??
The problem is that
submitbutton submits the page. Consider usinginstead of