How to add a button to @Html.ActionLink

Viewed 78

Here I am a beginner in MVC but I would like to add a button to my @Html.ActionLink:

@Html.ActionLink("Save", "Index",new { @class = "btn btn-info", id = m.pro_id })

I am using bootstrap css , but it looks like it doesn't apply.

Thank you

1 Answers

Use the following Html.ActionLink() method, that contains a route parameters and next is the HTML attributes for the button:

@Html.ActionLink("Save", "Index",  
        routeValues: new { id = m.pro_id }, 
        htmlAttributes: new { @class = "btn btn-default btn-info" })
Related