首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

MVC3 页面跳转,该怎么处理

2013-02-24 
MVC3 页面跳转我这里有Areas中有名叫AreaTest的区域,有控制器:TestController,里面有Action叫TestIndex pu

MVC3 页面跳转
我这里有Areas中有名叫AreaTest的区域,有控制器:TestController,里面有Action叫TestIndex
 public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "AreaTestdefault",
                "AreaTest/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
            );
        }
这样地址栏里面输入AreaTest/Test/TestIndex即可访问AreaTest区域中的页面TestIndex.cshtml


外面有HomeController和Index
这样地址栏里面输入Home/Index,则可访问Index.cshtml

现在我想通过Index.cshtml中的某个超级链接访问TestIndex.cshtml,怎么弄呢
<a href="@Url.Action("TestIndex", "Test")">是不行的






[解决办法]
<a href="@Url.Action("TestIndex", "AreaTest/Test")">即可

热点排行