1
我显示一个带有用户名列表的小表,并且我希望每个用户名旁边都有一个ActionLink来编辑另一个页面上的用户。Html ActionLink不显示
这是我的看法页:在EmployeeController
<%@ Page Title="" Language="C#"
Inherits="System.Web.Mvc.ViewPage<IEnumerable<WebUI.Models.IndexModel>>" %>
<table>
<tr>
<th></th>
<th>Username</th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td><% Html.ActionLink("Edit", "Edit", "Employee", new { id = item.UserID }, null); %></td>
<td><%: item.Username %></td>
</tr>
<% } %>
</table>
我的控制器方法:
public ActionResult Index()
{
List<IndexModel> model = new List<IndexModel>();
//load model with data
return View(model);
}
public ActionResult Edit(Guid id)
{
return View();
}
我的模型:
public class IndexModel
{
public Guid UserID { get; set; }
public string Username { get; set; }
}
的用户名正确显示,仅仅是链接不出现。我不知道为什么它不会抛出一个错误。
我在这里错过了什么?
谢谢:)它总是小事情,不是吗... – Steven 2011-01-05 20:45:35