Im making a small form for an index page.
@model MarketPlace.Models.Download
@{
ViewBag.Title = "Index";
}
@using (Html.BeginForm("Index", "Downloads", System.Web.Mvc.FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<td>@Html.DisplayNameFor(model => model.EMail)</td>
<td>@Html.TextBoxFor(model => model.EMail, new { @class = "form-control round-input", @style = "width:200px" })</td>
<td>@Html.DisplayNameFor(model => model.Reference)</td>
<td>@Html.TextBoxFor(model => model.Reference, new {@class = "form-control round-input", @style = "width:200px"})</td>
<td>@Html.DisplayNameFor(model => model.Products)</td>
<td>@Html.Buttonorsomething
}
I thought there would have been a `@Html.Button or something, and I searched on Google, but apparently they didn't add one.
My question is, how can I make a button?
edit: Please note, I've been using ASP.NET MVC for a very short time now, please forgive me for this silly question!
simply include pure html button it will work
like
<input type="button" value="Create" />
if you want a HTML button that will call your MVC controler's action method then . try this
<input type="button" value="Create" onclick="location.href='@Url.Action("Create", "User")'" />
Note : The best practice is to avoid obtrusive Javascript, you can have it as a separate onclick
method.
Update :
If you really want a helper then you can create a custom helper class type of MvcHtmlString
a good example you can find here
You can just use HTML in Razor:
<input type="submit" />
<input type="button" />
There isn't an helper for every HTML element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With