开发者

ActionLink without named query variables

开发者 https://www.devze.com 2023-04-06 08:18 出处:网络
I have an ActionLink that produces this URL @Html.ActionLink(\"Hardware Profile\", \"Profile\", \"Device\", new { id = 2, tab = \"hardware\"}, null)

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

精彩评论

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

关注公众号