How to create an Image button in MVC 4

一个人想着一个人 提交于 2019-12-08 16:41:49

问题


How do you create a plain old image button in MVC 4 (Razor)? I'm looking for something like this


回答1:


try this

 @using (Html.BeginForm("ActionTaken", "TestController"))   {
      <button name="button" value="ActionOne" class="button" style="width: 200px;">
         <img src=""/></button>
      <button name="button" class="button" style="width: 160px;" value="ActionTwo">
      <img src=""/></button>             }



回答2:


Add this to your razor view:

<input type="image" src="<image path here>" alt="Submit" width="48" height="48">


来源:https://stackoverflow.com/questions/17610391/how-to-create-an-image-button-in-mvc-4

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