Dr. Rajesh Rolen
Dr. Rajesh Rolen

Reputation: 14285

@Html.ActionLink not generating link

route :

   routes.MapRoute("Default", "{controller}/{action}/{id}/{args1}/{args2}/{args3}", // URL with parameters
              new
              {
                  controller = "Home",
                  action = "Index",
                  id = UrlParameter.Optional,
                  args1 = UrlParameter.Optional,
                  args2 = UrlParameter.Optional,
                  args3 = UrlParameter.Optional
              }
          );

Creating Link using below code:

 @Html.ActionLink("Photos", "List", "Photos");//"photos" is controller name and "list" is action name

its generating anchor but url/link is blank.

I have modified Route as i required some extra parameters for some actions.

I am new to MVC, Please provide me solution.

Upvotes: 3

Views: 817

Answers (1)

J R B
J R B

Reputation: 2136

Seems like default route is not active, if so then activate it.

routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

Upvotes: 3

Related Questions