ASP.NET MVC中通过Html.ActionLink动态生成链接
C# MVC模式下HTML.ActionLink() 用于生成指定Action的丽娜姐,非常有用
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" ➥Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server"> <p> This link is created by ActionLink() helper: <%= Html.ActionLink("click Me", "Somepage" ) %> </p> </asp:Content>
上面的页面执行后的连接将会变成下面的样子
<a href="/Home/Somepage">click me</a>