Home > Mobile >  I'd like to know how to use @Htmlhelper to pass values to controller while using Bootstrap fram
I'd like to know how to use @Htmlhelper to pass values to controller while using Bootstrap fram

Time:10-31

This is a jump I made using the ActionLink in @Htmlhelper, but my Bootstrap button design turned out like this:

@HTMLAction() button

@HTMLAction() button code is:

      <button class="btn btn-success btn-icon-split">
             <span class="icon text-white-50">
                   <i class="fas fa-edit"></i>
             </span>
                   @Html.ActionLink("Edit", "EditForm", "Dashboard", new { id = Model.FormId })
      </button>

When I jump with the <a> tag it renders this effect:

 tag

HTML markup is:

    <button href="/Dashboard/EditForm" class="btn btn-success btn-icon-split">
          <span class="icon text-white-50">
                  <i class="fas fa-edit"></i>
          </span>
                    <span class="text" id="Edit">Edit</span>
    </button>

While I use Htmlhelper to pass values while jumping, I can't achieve such a normal effect anyway.

CodePudding user response:

try this :

<button href="/Dashboard/EditForm" class="btn btn-success btn-icon-split">
    <span class="icon text-white-50">
            <i class="fas fa-edit"></i>
    </span>

    <a class="text" href="@Html.ActionLink("Edit", "EditForm", "Dashboard", new { id = Model.FormId })" id="Edit">Edit</a>
</button>

CodePudding user response:

Seems like not proper Html.ActionLink() method is used.

Try to add the null after routeValues parameter:

<button class="btn btn-success btn-icon-split">
    <span class="icon text-white-50">
        <i class="fas fa-edit"></i>
    </span>
    @Html.ActionLink("Edit", "EditForm", "Dashboard", new { id = Model.FormId }, null)
</button>
  • Related