ASP.NET MVC: Html.Actionlink() generates empty link.

Posted by wh0emPah on Stack Overflow See other posts from Stack Overflow or by wh0emPah
Published on 2010-05-06T07:35:25Z Indexed on 2010/05/06 7:38 UTC
Read the original article Hit count: 537

Okay i'm experiencing some problems with the actionlink htmlhelper.

I have some complicated routing as follows:

        routes.MapRoute("Groep_Dashboard_Route", // Route name
                        "{EventName}/{GroupID}/Dashboard", // url with Paramters
                        new {controller = "Group", action="Dashboard"});

        routes.MapRoute("Event_Groep_Route", // Route name
                        "{EventName}/{GroupID}/{controller}/{action}/{id}",
                        new {controller = "Home", action = "Index"});

My problem is generating action links that match these patterns. The eventname parameter is really just for having a user friendly link. it doesn't do anything.

Now when i'm trying for example to generate a link. that shows the dashboard of a certain groep. Like:

  mysite.com/testevent/20/Dashboard

I'll use the following actionlink:

<%: Html.ActionLink("Show dashboard", "Group", "Dashboard",  new { EventName_Url = "test", GroepID = item.groepID}, null)%>

What my actual result in html gives is:

 <a href="">Show Dashboard</a>

Please bear with me i'm still new at ASP MVC. Could someone tell me what i'm doing wrong?

Help would be appreciated!

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about ASP.NET