在其資料夾之外的位置使用控制器時,有必要建立指向所需方法的連結。對於 Html.ActionLink 方法,需要以下參數:
ASP.NET MVC1:
public static string ActionLink(this HtmlHelper htmlHelper, string linkText, string controllerName, string actionName, object values, object htmlAttributes)
ASP 。網MVC2:
public static string ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, object values, object htmlAttributes)
ASP.NET MVC3 :
public static string ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, object values, object htmlAttributes)
考慮以下場景:
public class ItemController:Controller { public ActionResult Login(int id) { return View("Hi", id); } }
以上是如何在 ASP.NET MVC 中的資料夾之外建立指向控制器的操作連結?的詳細內容。更多資訊請關注PHP中文網其他相關文章!