In my view the call below generates url ending with Tasks/Edit but I want it to generate url like Tasks/Edit/23
<%= Html.ActionLink<TaskController>("Edit Task", (x) => x.Edit("23"))%>
in Global.asax:
string taskController = NameResolver.NameOfController<TaskController>();
string editAction = NameResolver.NameOfAction<TaskController>(x => x.Edit(null));
routes.MapRoute(
"EditTasks",
"Tasks/Edit/{id}",
new { controller = taskController, action = editAction, id = string.Empty });
I also have binding problem in this action. Values set from view is not binded to my Edit parameter. It comes null everytime and I have not set DefaultModelBinder anywhere. Here is the Edit action:
public ActionResult Edit (string id)
{
//retrieve some data and pass it to view and return view
}
So what can be the problem here? How can I solve url and binding problem? And yes I am a Asp.Net Mvc beginner :)