MVC a 标签跳转页面 href怎么写
在MVC中,使用标签跳转页面时,可以使用以下格式的href:
<a href="@Url.Action("ActionName", "ControllerName")">Link Text</a>
其中,ActionName表示要跳转的Action名称,ControllerName表示要跳转的Controller名称。
例如,要跳转到HomeController中的Index方法,可以使用以下代码:
<a href="@Url.Action("Index", "Home")">Go to Home</a>
注意,在MVC中,使用@符号来引用C#表达式。因此,@Url.Action()方法用于生成URL。
原文地址: https://www.cveoy.top/t/topic/bgiN 著作权归作者所有。请勿转载和采集!