Replies: 1 comment
-
@aurquiel Thank you for using BlazorBootstrap. Please check the link below: https://demos.blazorbootstrap.com/modals#events Example<Modal @ref="modal"
title="Modal title"
OnShowing="OnModalShowing"
OnShown="OnModalShown"
OnHiding="OnModalHiding"
OnHidden="OnModalHidden"
OnHidePrevented="OnModalHidePrevented">
<BodyTemplate>
Modal body text goes here.
</BodyTemplate>
<FooterTemplate>
<Button Color="ButtonColor.Secondary" @onclick="OnHideModalClick">Close</Button>
<Button Color="ButtonColor.Primary">Save changes</Button>
</FooterTemplate>
</Modal>
<Button Color="ButtonColor.Primary" @onclick="OnShowModalClick">Show Modal</Button>
@code {
private Modal modal = default!;
[Inject] ToastService ToastService { get; set; } = default!;
private async Task OnShowModalClick()
{
await modal.ShowAsync();
}
private async Task OnHideModalClick()
{
await modal.HideAsync();
}
private void OnModalShowing()
{
ToastService.Notify(new (ToastType.Primary, $"Event: Showing called. DateTime: {DateTime.Now}"));
}
private void OnModalShown()
{
ToastService.Notify(new (ToastType.Success, $"Event: Show called. DateTime: {DateTime.Now}"));
}
private void OnModalHiding()
{
ToastService.Notify(new(ToastType.Danger, $"Event: Hiding called. DateTime: {DateTime.Now}"));
}
private void OnModalHidden()
{
ToastService.Notify(new(ToastType.Warning, $"Event: Hide called. DateTime: {DateTime.Now}"));
}
private void OnModalHidePrevented()
{
ToastService.Notify(new(ToastType.Info, $"Event: Hide Prevented called. DateTime: {DateTime.Now}"));
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
is it posiible to add and event or a callback when a modal is closed by clicking outside the modal or due to a button close.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions