5


I want to be able to pass link to view from controller. Is there anything like Html.ActionLink on the server side?
Thank you for your help!

5
  • Html.ActionLink is server side. Please refine the question. Commented Sep 29, 2010 at 8:17
  • I'm going to use it from controller. How do I do it? Commented Sep 29, 2010 at 8:18
  • Can you be more specific? Do you want to pass a url or perhaps a route to the view as part of the Model parameter? Commented Sep 29, 2010 at 8:20
  • In the view it now looks like <%: Html.ActionLink(supply.SupplyName, "Edit", new { id = supply.ID })%>. I want to pass it through Model. Like Model.MyLink Commented Sep 29, 2010 at 8:22
  • hey i'm not sure you can do that there. The LinkExtensions needs the view context which you wont have at the controller point. Commented Sep 29, 2010 at 8:34

1 Answer 1

8

In your controller you can use Url.Action to generate a new url using actions, controllers and routevalues.

This will not return a <a> tag, but only the url, for you to use in your controller.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.