Hello
I am using ASP.NET CORE EJ 2 version 16.1.0.37 (nuget package).
When creating a modal dialog I would like to hide it by default and only show it on demand. Thus I set the "Visible" property to "false". However, when visiting the site the dialog is always displayed right away.
I found a workaround by using the "Created" event and hiding the dialog there, then it shows up only briefly before it is hidden.
@Html.EJS().Dialog("MyDialogId").Visible(false).IsModal(true).Created("onDialogCreated").Target("body").Width("300px").Height("300px").Position(p => p.X("center").X("center")).Content("").Header("").Buttons(new List<DialogDialogButton>
{
new DialogDialogButton{ ButtonModel = new { content = "OK" }, Id = "myDialogButtonId", Click = "dialogButtonClicked" }
}).Render()
<script>
...
function onDialogCreated(args) {
var dialog = document.getElementById("MyDialogId").ej2_instances[0];
dialog.hide();
}
...
</script>
When visiting the demo site for the dialog control the same issue seems to happen. In the source the "Visible" property is set to "false" but they still show up and are hidden a few seconds later.
Is there a better solution to hide the dialog by default and only showing it when needed?
Kind regards
Phil