I have an action link in one of my view page
<%=Html.ActionLink("Details", "Details", new { id = Model.Id })%>
and redirects me to page which has a url like this http://localhost:1985/Materials/Details/2
instead of this i would like to have my url as http://localhost:1985/Materials/Details/steel
material name instead of Id... Is this possible...... This is my controller action method,
public ActionResult Details(int id)
{
var material = consRepository.GetMaterial(id);
return View("Details", material);
}
EDIT: I am iterating my json object returned from a jsonresult controller....
$.each(data.Results, function() {
divs += '<a href="/Materials/Details/' + this.Id + '">Details</a>
<a href="/Materials/Edit/' + this.Id + '">Edit</a></div>';
});
My route look like this,
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Materials", action = "Index", id = "" }
);