how can i close dialog when user use back button? if user open dialog/modal and they push back button, they didnt close the dialog, but they back to before page.
I want to close dialog when user use back button. can i do that with syncfusion dialo?
|
<SfButton @onclick="@OpenDialog">Open Modal Dialog</SfButton>
<SfDialog @ref="dlgObj" Width="250px" @bind-Visible="@IsVisible" ShowCloseIcon="true">
<DialogEvents>
</DialogEvents>
<DialogTemplates>
<Content> This is a modal dialog </Content>
</DialogTemplates>
</SfDialog>
@code {
SfDialog dlgObj;
protected static bool IsVisible { get; set; } = false;
private void OpenDialog()
{
dlgObj.ShowAsync();
}
[JSInvokable]
public static void CSCallBackMethod()
{
IsVisible = false;
} } |
| <script>
window.onbeforeunload = () => {
DotNet.invokeMethodAsync('Dialog', 'CSCallBackMethod');
} </script> |
i tried implemented your code and it still going back, then i tried to open your example, and it still going back, not closing the modal
I tried implementing your code and it still going back, then I tried to open your example, and it still went back, not closing the modal