chairmanPC
Active member
- Joined
- Apr 19, 2021
- Messages
- 38
- Programming Experience
- 10+
This is my first ASP.NET Core project. I started with adding a button that will check if it is clicked. It will print a YES when it's clicked. but when I hit the button, I got into this Error 404 page. What did I do wrongly?
And this below is my btnCheckController.
Where did I do wrongly?
Index page:
@{
ViewData["Title"] = "Index";
}
<form class="text-center">
<button name="button" asp-action="checkValue">Check if Pressed</button>
</form>
<div class="text-center">
Status: @TempData["status"]
</div>
And this below is my btnCheckController.
btnCheckController:
namespace firstASPNETApp.Controllers
{
public class btnCheckController : Controller
{
public IActionResult Index()
{
return View();
}
public IActionResult checkValue()
{
TempData["status"] = "YES";
return RedirectToAction("Index");
}
}
}
}
Where did I do wrongly?