链接到图像的MVC按钮
本文关键字:MVC 按钮 图像 链接 | 更新日期: 2023-09-27 18:05:33
我是c#的新手,所以我有一个图像链接到控制器的麻烦。
我创建了这个将用户路由到控制器的链接。现在它是一个提交按钮,给出了"现在注册"这个词,但我想用一个图像代替它。我没有麻烦创建链接,只是一个简单的按钮,但不知道如何做到这一点与图像。
这是我的代码
@Html.SubmitButton("Sign Up Now!", OrdersController.AddSubscriptionRoute, new { pl=1, itemCode = Model.ItemCode, webId = Model.WebID, webCategoryId = Model.WebCategoryID, priceTypeId = Model.PriceTypeID }, null, ActionEmphasis.Callout)
我想使用image
<img src="/_resources/images/content/callout.jpg" style="float:right">
如果你想让表单发送到一个特定的动作,你只需要做下面的事情:
<form action="<%:Url.RouteUrl("Your Route Here");%>" method="post">
<!-- Html Input elements -->
<input type="image" src="/_resources/images/content/callout.jpg" style="float:right;" alt="Submit" />
</form>
如果您需要在表单上使用多个按钮,请考虑这篇文章:
http://blog.maartenballiauw.be/post/2009/11/26/Supporting-multiple-submit-buttons-on-an-ASPNET-MVC-view.aspx