开发者

asp.net mvc3 razor custom button helper

开发者 https://www.devze.com 2023-03-22 15:29 出处:网络
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 in

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 bu开发者_运维问答tton. 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!


Use the Url.Action method for this problem.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消