In my example I'm unable to call a controller from a button click. My button code is :
<button id="confirmsignup" name="confirmsignup" class="btn btn-success" onclick="location.href='@Url.Action("RegisterUser", "Home")'" >Sign Up</button>
My Controller is HomeController.
My Action Method is :
[HttpPost]
public ActionResult RegisterUser(UserInfo objUser)
{
int res= udaObj.RegisterUser(objUser);
}
location.hrefwon't post back. It redirects the current page to/Home/RegisterUserpage withHttpGetstatus. What are you trying to achieve?