Home > Blockchain >  HTML button from ActionLink in MVC5
HTML button from ActionLink in MVC5

Time:11-16

I have ActionLinks like so:

    <td class="options">
        @Html.ActionLink("Settings", "RedirectToSettings", new { locationId = item.LocationId })
    </td>

But I want to make it into a button instead of just clickable text. Whether it's making the entire cell clickable or adding in a button element.

I've looked at other questions on SO such as enter image description here

How can I make this work? Any help is greatly appreciated!

Update:

Using Html.BeginForm solves the issue, props to Serge for the idea.

    <td class="options">
        @using (Html.BeginForm("RedirectToSettings", "Configs", new { locationId = item.LocationId }))
        {
            <input type="submit" value="Settings"/>
        }
    </td>

CodePudding user response:

try this

  <td class="options">
 @using(Html.BeginForm("RedirectToSettings","Settings"))
         {
           <input type="hidden"  value="@item.LocationId" />
           <input type="submit" value="Settings" />
         }
  <td class="options">
  • Related