James
James

Reputation: 719

Accessing page in different folder

I have this line in one my views in my home folder

@Html.ActionLink("Edit", "Edit", new { id = item.ResearcherID })

When I click it will take me to Home/Edit/id

However my Edit page is located in Researchers/Edit

I tried doing:

@Html.ActionLink("Edit", "Researchers","Edit", new { id = item.ResearcherID })

but it took me to this page instead http://localhost:12345/Home/%20Researchers?Length=4

How can I link to my desired page?

Upvotes: 0

Views: 33

Answers (2)

Dan Wilson
Dan Wilson

Reputation: 4047

The researchers edit page is part of the Researchers controller. Specify the Edit action on the Researchers controller in your ActionLink() call.

@Html.ActionLink("Edit", "Edit", "Researchers", new { id = item.ResearcherID }, null)

LinkExtensions.ActionLink Method

public static MvcHtmlString ActionLink(
    this HtmlHelper htmlHelper,
    string linkText,
    string actionName,
    string controllerName,
    object routeValues,
    object htmlAttributes
)

Upvotes: 1

Ayoub Codes.
Ayoub Codes.

Reputation: 988

if this Researchers is controller try this : @Html.ActionLink("Edit", "Edit","Researchers", new { id = item.ResearcherID })

Upvotes: 0

Related Questions