I have two buttons on my cshtml page – Agree and Disagree – how can I easily pass back there values to my Controller so I can make a decision to either take them to Homepage or Log them back out.
So on my cshtml page I have…
<input type="button" name='Agree' value="I Agree"
onclick="location.href='@Url.Action("DoAccept", "Home")'" />
<input type="button" name='Delete' value="I Disagree"
onclick="location.href='@Url.Action("DoAccept", "Home")'" />
So In my Home Controller then I have a DoAccept method as below:
public ActionResult DoAcceptTC()
{
//if( buttom clicked was Agree)
return RedirectToAction(VIEW_HOMEPAGE);
//else
//return Logout page..
}
So My question is how can I easily get a value back to the controller method?
There’s no much point in using inputs without html form hosting them. You could use form, or simple links