ActionLink with glyphicon and Button


I would like to know how I can do so that this @Html.ActionLink("Edit", "Edit", new { id = item.IDPROJECT}) can format it, I did it this way but it does not work for me:

<a href="@Url.Action("Edit", "Proyectos")" class="btn btn-warning" >Editar
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>

this is the result I want

asked by Daniel 13.12.2017 в 18:17

1 answer


You can do it in the following way by means of the method ActionLink :

@Html.ActionLink("Editar", "Edit", "Proyectos", new { Id = item.IDPROJECT },
    new { @class = "btn btn-warning glyphicon glyphicon-edit" });

Where the fourth parameter is an object of type IDictionary<string, object> , called htmlAttributes .

answered by 13.12.2017 / 18:48