gpt4 book ai didi

c# - 获取 Html.RouteLink 结果的 URL 地址

转载 作者:太空宇宙 更新时间:2023-11-03 21:59:17 25 4
gpt4 key购买 nike

结果

@Html.RouteLink("link-name" , "route-name" , new 
{
id = "8850" ,
title = "sample-title" ,
description = "sample-description"
}
)

<a href="/8850/sample-title/sample-description/">link-name</a>

有没有只提供href地址的扩展方法?

最佳答案

您可以使用"Url.Action":

UrlHelper 类:

Action(string actionName, string controllerName, RouteValueDictionary routeValues);

对于其他重载,检查这个:

UrlHelper.Action Method

例如。

<a href="@Url.Action(actionName, controllerName, routeValues)">link-name</a>

关于c# - 获取 Html.RouteLink 结果的 URL 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10931897/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com