Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
public override string AreaName
       {
           get
           {
               return "ImportNightflight";
           }
       }

       public override void RegisterArea(AreaRegistrationContext context)
       {
           context.MapRoute(
               "ImportNightflight_default",
               "ImportNightflight/{controller}/{action}/{id}",
               new { action = "Index", id = UrlParameter.Optional }
           );
       }


  • @Html.ActionLink("Nightflight - Upload and import rows", "Upload", new { controller = "ImportedDocs", area = "ImportNightflight" })

this only return href="": Nightflight - Upload and import rows
Posted

1 solution

you have to add namespaces of your controller in RegisterArea method:

C#
public override void RegisterArea(AreaRegistrationContext context)
       {
           context.MapRoute(
               "ImportNightflight_default",
               "ImportNightflight/{controller}/{action}/{id}",
               new { action = "Index", id = UrlParameter.Optional }
               namespaces: new[] {"Write your controller's namespace"}
           );
       }



For more help visit:
Areas in ASP.NET MVC 4[^]
 
Share this answer
 
Comments
Rajib Mahata 25-Mar-14 11:23am    
I also do that but does not work
Rajib Mahata 26-Mar-14 1:09am    
AreaRegistration.RegisterAllAreas();

this function does not call

namespace ArleATPImportWebApp.Areas.ImportNightflight
{
public class ImportNightflightAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "ImportNightflight";
}
}

public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"ImportNightflight_default",
"ImportNightflight/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
,namespaces: new[] { "ArleATPImportWebApp.Areas.ImportNightflight.Controllers" }
);
}
}
}
this class

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900