Wednesday, 28 August 2013

View not rendering from controller

View not rendering from controller

here's the thing. I have this view named "Testing":
@model Project.Models.Test
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Testing</title>
</head>
<body>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
--- some html and razor using model attributes ---
}
</body>
</html>
And in TestController, the ActionResult method that should return the view.
public ActionResult Testing(int id) {
Test test = db.Test.Find(id); (I have a breakpoint in here)
if (test == null)
{
return HttpNotFound();
}
return View(test);
}
For some reason if I write on the address bar in the browser
localhost:(number of port)/Test/Testing/1 the view renders but not from
the controller, because I have a breakpoint in the controller and it
doesn't execute that instructions. Because of that, everything is null
obviusly because there's no object. I don't know why the view is rendering
without calling the controller action.
Edit: My routeconfig look like this

No comments:

Post a Comment