user7221204
user7221204

Reputation: 99

Show an actionlink in a tooltip mvc razorview

I have a datatable with Edit,Delete actionlinks in each row. Instead of showing them as a column in the table, I would like to show them in a tooltip to save space. I am not sure how this can be achieved. I would like the tooltip to appear on the @rowNo.ToString("000") field. Thanks for the help. My code is as follows:

 <tbody>
            @foreach (var item in Model)
                {
                    rowNo++;
                <tr>
                    <td>
                        @rowNo.ToString("000")

                        @Html.ActionLink("Edit", "Edit", new { id = item.Id }) 
| @Html.ActionLink("Delete", "Delete", new { id = item.Id })
                        </td>
    </tr>
    </tbody>

Upvotes: 0

Views: 496

Answers (1)

thmshd
thmshd

Reputation: 5847

It really depends on your HTML Framework. Assuming, you might probably use Bootstrap, I'd suggest something like Dropdowns. I think, by the example, you get the point...

<div class="dropdown show">
  <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Actions...
  </a>

  <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
    @Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { @class = "dropdown-item" }) 
    @Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { @class = "dropdown-item" })
  </div>
</div>

Upvotes: 1

Related Questions