BuildUrlFromExpression inside of HTML - getting 404 error from link

Posted by ctote on Stack Overflow See other posts from Stack Overflow or by ctote
Published on 2012-07-29T05:39:46Z Indexed on 2013/06/27 4:22 UTC
Read the original article Hit count: 243

Filed under:
|

I'm trying to build a link that will direct the user to an MVC page when they click it. Currently I have:

HTMLTable.AppendLine("<td class=\"team\"> " + tournament.TournamentRoundMatches[col][effective_match_id].competitorId1 + "<a href=\"<% =Html.BuildUrlFromExpression<CompetitionController>(c => c.Details(83)) %>\">" + "  update" + "</a>" + "</td>");

But this just results in a 404 error, with the following link generated:

localhost:52313/Tournament/Details/%3C%%20=Html.BuildUrlFromExpression%3CCompetitionController%3E(c%20=%3E%20c.Details(83))%20%%3E

My controller method looks like this:

[Authorize]
    public ActionResult Details(int id)
    {
        var competition = Competition.getCompetitionById(id);

        return View(competition);
    }

Does anyone see what I might be doing wrong?

© Stack Overflow or respective owner

Related posts about html

Related posts about asp.net-mvc