Fisrt of all let me demonstrate a problem in this short video.
I have a button that displays a modal window. On click event of that button there is a script that puts a view inside modal-body.
In this project I have two layouts basically. One with header and one without it. As you can guess the one with a header is the main one. And I don't need a header inside modal window, so there is a second one. I think it's somehow messed up with layouts, but I'm not sure.
[/CODE]
Any ideas how I can solve this issue? Been stuck with it for a while.
Also there is another problem. If I set a layout of the view inside modal window to a null value, that'll work, but when the validation kicks in, the layout turns into null.
Here is a quick video of a layout = null issue
I have a button that displays a modal window. On click event of that button there is a script that puts a view inside modal-body.
JavaScript:
showInPopup = (url, title) => {
$.ajax({
type: "GET",
url: url,
success: function (res) {
$("#form-modal .modal-body").html(res);
$("#form-modal .modal-title").html(title);
$("#form-modal").modal('show');
}
})
}
In this project I have two layouts basically. One with header and one without it. As you can guess the one with a header is the main one. And I don't need a header inside modal window, so there is a second one. I think it's somehow messed up with layouts, but I'm not sure.
Here is the main layout, here I have a header and a popup menu. Put it here following a guide.:
[CODE=html]<!DOCTYPE html>
<html lang="en">
<head>
<partial name="_MetaPartial" />
<partial name="_CssPartial" />
</head>
<body class="background-normal">
<partial name="_HeaderPartial" />
<div class="container">
<partial name="_NotificationPartial" />
@RenderBody()
</div>
@* Add/Edit popup menu *@
<div class="modal fade" id="form-modal" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false" aria-labelledby="pop" aria-hidden="true" data-bs-theme="dark">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title text-light" id="pop"></h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
<partial name="_ScriptsPartial" />
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
The second layout, that I use for modal window:
<!DOCTYPE html>
<html lang="en">
<head>
<partial name="_MetaPartial" />
<partial name="_CssPartial" />
</head>
<body class ="background-normal mt-2">
<div class="container">
@RenderBody()
</div>
<partial name="_ScriptsPartial" />
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
Any ideas how I can solve this issue? Been stuck with it for a while.
Also there is another problem. If I set a layout of the view inside modal window to a null value, that'll work, but when the validation kicks in, the layout turns into null.
Here is a quick video of a layout = null issue
Last edited: