我正在尝试构建一个链接,当用户单击它时将其定向到 MVC 页面。目前我有:
HTMLTable.AppendLine("<td class=\"team\"> " + tournament.TournamentRoundMatches[col][effective_match_id].competitorId1 + "<a href=\"<% =Html.BuildUrlFromExpression<CompetitionController>(c => c.Details(83)) %>\">" + " update" + "</a>" + "</td>");
但这只会导致 404 错误,并生成以下链接:
localhost:52313/Tournament/Details/%3C%%20=Html.BuildUrlFromExpression%3CCompetitionController%3E(c%20=%3E%20c.Details(83))%20%%3E
我的控制器方法如下所示:
[Authorize]
public ActionResult Details(int id)
{
var competition = Competition.getCompetitionById(id);
return View(competition);
}
有谁看到我可能做错了什么?