Skip to content

Instantly share code, notes, and snippets.

@shaneprice
Last active January 29, 2023 08:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save shaneprice/bc69d6e318b063493948 to your computer and use it in GitHub Desktop.
Save shaneprice/bc69d6e318b063493948 to your computer and use it in GitHub Desktop.
#View#
<button class="btn btn-primary btn-lg" data-toggle="modal" id="load-partial">
Load partial view
</button>
<div class="modal fade" id="dynamic-modal">
</div>
@section scripts
{
<script>
$("#load-partial").on('click', function () {
console.log('click');
//setup modal
$('#dynamic-modal').modal({
keyboard: false,
remote: '/home/partial'
}).show();
});
$('#dynamic-modal').on('showen.bs.modal', function(e) {
console.log('shown');
});
$(function() {
});
</script>
}
#Partial Controller#
public ActionResult Partial()
{
var list = new List<Guid>();
for (int i = 0; i < 5; i++)
{
list.Add(Guid.NewGuid());
}
ViewBag.List = list;
return PartialView("_MyPartialView");
}
#Partial View#
<h1>Hola</h1>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Modal title</h4>
</div> <!-- /modal-header -->
<div class="modal-body">
<ul>
@foreach (Guid listItem in ViewBag.List)
{
<li>@listItem.ToString()</li>
}
</ul>
</div> <!-- /modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
@mrnams
Copy link

mrnams commented Oct 9, 2018

Hello experts,I want to implement load more button for my website ,https://mrnams.com

Can any one please give idea how to implement load more button to load more videos without refreshing (I mean without loosing loaded videos) page.

Similar to youtube functionality.

I am using .net core 2.1 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment