0

From a view I would like to know if with a button can call a @Html.Partial when I click using onClick() instead to have it in the view always?

@Html.Partial("~/Views/Home/Search.cshtml")

Button

<a class="btn btn-outline-info mx-2 mx-sm-1" id="nav-btn" data-toggle="modal"  
data-target="modal-data" ><i class="bi bi-upc-scan"></i></a>

Michaelweston
  • 149
  • 1
  • 11
  • 2
    You can render, but hide the html fragment. Then use javascript to hide/show the section. Or you can use AJAX to have the server render and send the fragment -- again, with javascript, attach the fragment to the dom. And the third way is to re-render the page with the fragment rendered in place. – Jasen Feb 22 '22 at 19:24
  • You can find here https://stackoverflow.com/questions/29142422/rendering-partial-view-on-button-click-in-asp-net-mvc – Zahid Mustafa Feb 23 '22 at 04:31

0 Answers0