I've written some code to load a section of my application between views. While my code works, I'm wondering if there is a better way to do it. (partial views perhaps?) I currently load the views, then show/hide them depending on a button click.
<div id="wrapper">
@*Sidebar*@
@Html.Partial("_AdministrationSidebar")
@*PAGE CONTENT*@
<div id="page-content-wrapper">
<div id="manage" style="clear: both;"></div>
<div id="edit" style="clear: both;"></div>
<div id="create" style="clear: both;"></div>
</div>@*page-content-wrapper*@
</div>@*wrapper End*@
<script>
$(document).ready(function () {
$("#manage").load("RolesAdmin/Manage/");
});
function editItem(Id) {
$("#edit").load("RolesAdmin/Edit/" + Id);
$("#manage").hide();
$("#edit").show();
}
function createItem(Id) {
$("#create").load("RolesAdmin/Create/" + Id);
$("#manage").hide();
$("#create").show();
}
function manageItem() {
$("#manage").show();
$("#create").hide();
$("#edit").hide();
}
</script>