开发者

ActionLink without named query variables

I have an ActionLink that produces this URL

@Html.ActionLink("Hardware Profile", "Profile", "Device", new { id = 2, tab = "hardware"}, null)

//Produces: http://localhost:7946/Device/Profile/2?tab=hardware

But what I want it to produce is:

http://localhost:7946/Device/Profile/2/hardware

I have the following route setup

routes.MapRoute(
                "DeviceProfile",
                "device/profile/{id}/{tab}",
                new { c开发者_如何学Goontroller = "Device", action = "Profile", id = UrlParameter.Optional, tab = UrlParameter.Optional }
            );

How do I achieve this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜