I`m using @Url.Action to display link but the problem is the title of link which it uses has empty spaces between words.
Ive tryed various methods trims and convert but noone worked.
Please help! Im trying to convert empty spaces into "-".
View:
<h3>
<a href="@Url.Action("oglas", new { controller = "Home", action = "oglas" })">@item.title</a>
</h3>
Controller:
public ActionResult Index()
{
trazimhr_bazaEntities DB = new trazimhr_bazaEntities();
List < post_job > post_Jobs = DB.post_job.ToList();
return View(post_Jobs);
}
[ActionName("oglas")]
public ActionResult Rezultat(string slug)
{
return View("rezultat");
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default", url: "{controller}/{action}/{id}", defaults: new {
controller = "Home",
action = "Index",
id = UrlParameter.Optional
});
}