What am i doing wrong with this in asp.net-mvc?
- by Pandiya Chendur
I gave this in my site.master
<li><%= Html.ActionLink("Material", "Index", "Material")%></li>
But my link doesnt seem to get my material controller Index method... I have this in my global asax file,
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Material", action = "Index", id = "" }
);
}
My controller:
public class MaterialController : Controller
{
//
// GET: /Material/
Material material = new Material();
public ActionResult Index()
{
var materials = material.FindAllMaterials();
return View();
}
}
What am i doing wrong.... When i click the link i get
The resource cannot be found. error.. Any suggestion...