1

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!

0

2 Answers 2

1

Use the Url.Action method for this problem.

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

Comments

1

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).

1 Comment

Yeah I just got it to work. I used @Url.Action and passed as string to the c# class. Works great. Thank you!

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.