Declined
Last Updated: 20 Oct 2022 12:30 by ADMIN
Rick
Created on: 14 Oct 2022 12:16
Category: Dialog
Type: Feature Request
0
Need some way to know when the dialog has been rendered

Currently using VisibleChanged event, I can tell when a dialog is closed.  However, if you have a component inside the dialog and trying to reference that component before the dialog is fully rendered you get a null reference exception.

What I am proposing is adding a new event or extending VisibleChanged so that we know when the dialog has been initialized.

1 comment
ADMIN
Dimo
Posted on: 20 Oct 2022 12:30

Hello Rick,

It depends if you are talking about server-side or client-side rendering. For server-side (pre)rendering, use OnAfterRenderAsync. On the other hand, the Blazor framework does not provide a way to detect rendering in the browser. The closest event is again OnAfterRenderAsync, but you may know that it fires on the server, before the HTML markup is sent to the client.

In either case, when OnAfterRenderAsync fires for a given component, this ensures that the component reference is set. If you also need the browser rendering to be complete, use a small Task.Delay() (when you execute C# logic) in the handler, or call JSInterop with setTimeout() in the JavaScript logic.

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.