bobek
bobek

Reputation: 8020

asp.net mvc3 razor custom button helper

I've created a custom button helper. I pass text, url, css attributes, and everything works perfectly fine. The only thing that I would like to improve is to incorporate a ActionLink functionality into that button. For example I would like to pass the action name and the controller name and that would return the link to that page (just like ActionLink)

Does anyone worked on that same issue and is willing to share, or at least give me hint on how to do it? thank you for help!

Upvotes: 1

Views: 529

Answers (2)

Chaim Zonnenberg
Chaim Zonnenberg

Reputation: 1823

Use the Url.Action method for this problem.

Upvotes: 1

SLaks
SLaks

Reputation: 887469

You can use the methods in the Url object to get URLs for actions.

If you don't have a Url object, you can write new UrlHelper(ViewContext.RequestContext).

Upvotes: 1

Related Questions