Html.ActionLink gives error: cannot resolve action

I am using Html.ActionLink in my jquery. But I get an error when I type my Action Names, check my update.

Why am I getting this? I really need to use ActionLink here.

Here is the jquery code:

result.forEach(function (goalcard) {
    $("#GoalcardSearchResult tbody").append(
            $('<tr/>', {
                click: function () {
                    id = goalcard.Id;
                    var url = '@Url.Action("AnswerForm", "AnswerNKI", new { id = "__id__"})';
                    window.location.href = url.replace('__id__', id);


                },
                // steg Create a row for each result 
                html: "<td>" + goalcard.Name +
                "</td><td>" + goalcard.Customer +
                "</td><td>" + goalcard.PlannedDate +
                "</td><td>" + goalcard.CompletedDate + 
                "</td><td>" + '@(Html.ActionLink("Ändra", "Edit","Admin")) | @(Html.ActionLink("Skapa Mall", "Inactive","Admin", new { @class = "deleteLink" })) | @(Html.ActionLink("Genomför","AnswerForm","AnswerNKI"))' + "</td>"
            }));
    });
    $('#GoalcardSearchResult tbody').trigger("update");
    $("#GoalcardSearchResult").tablesorter({
        headers: { 4: { sorter: false } }
    });
});

UPDATE:

Problem found, my action methods have int ID as parameter. I need to do the following:

@(Html.ActionLink("Genomför", "AnswerForm", "AnswerNKI", new {id = goalcard.id}, null))

goalcard.id carry an identifier, but in some strange way I get a new error:

Unable to resolve goalcard symbol

Any help is appreciated!

Thanks in advance!

+5
source share
1 answer

? ? , T4MVC , , , JSON.

http://t4mvc.codeplex.com/

, , .

, [HttpPost].

-2

All Articles