Wrapping an element with Html.ActionLink..?

百般思念 提交于 2019-12-23 07:03:22

问题


I'd like to wrap a span with an action link because I'm adhering to an existing CSS theme. It doesn't look like any of Html.ActionLink's constructors allow for this. Possible solutions:

  1. A way to achieve this with existing helper?
  2. Derive & override ActionLink with new custom html helper?

If #2 is the only way I have two questions.

  1. When I right click ActionLink and hit go to definition I only see the constructor signature not that actual code body. How do I see the original function body? I don't see anything on MSDN either
  2. The above will more or less tell me, but, how to generate action url dynamically?c

回答1:


<a href="<%= Url.Action(...) %>"><span></span></a>


来源:https://stackoverflow.com/questions/3470622/wrapping-an-element-with-html-actionlink

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!