Home > Software design >  How to add a button to @Html.ActionLink
How to add a button to @Html.ActionLink

Time:01-06

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

CodePudding user response:

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" })
  •  Tags:  
  • Related