How to make a actionlink as Image in Asp.Net MVC4 Razpr View?

北慕城南 提交于 2019-12-13 04:03:32

问题


NET MVC4 with Entity Framework. I am trying Rating control, for that I am using @Url.Action. Now i have to convert action link to star image button. Please anyone give me an idea to getit.

This is my code:

<a href="@Url.Action("rated/4", "Rating")">Half</a>
<a href="@Url.Action("rated/5", "Rating")">One</a>
<a href="@Url.Action("rated/6", "Rating")">One and Half</a>
<a href="@Url.Action("rated/7", "Rating")">Two</a>
<a href="@Url.Action("rated/8", "Rating")">Two and half</a>

回答1:


You can simply add your image tag before closing </a>. see code below:

 <a href="@Url.Action("rated/4", "Rating")"><img style="border:0;" src="image path" alt="Half"></a>


来源:https://stackoverflow.com/questions/22007291/how-to-make-a-actionlink-as-image-in-asp-net-mvc4-razpr-view

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