You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to create multiple components dynamically at runtime and insert them at dynamically created containers.
So at development time I don't know how many containers will be available, where are they placed and which components will be created and in which container they will be inserted. All this should happen at runtime.
With BuildRenderTree I'm able to create HTML at runtime and insert this at a specific place on my page. It is also possible to call OpenComponent on the RenderTreeBuilder but you can't hand over an instance of your component, you only have the possibility to specify the type of your component and Razor will then create an instance of your component. So you don't have the reference to this created instance and can't call methods, etc. of this component. Also everytime the BuildRenderTree method is called the same instance of the previously created component will be used by Blazor.
Is it possible to create a full component at runtime by code, have an instance of this component and place the component on your page? With BuildRenderTree, DynamicComponent and RenderFragment it seems not possible. Is there anything else or should I create an issue so this can be added in a future release?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I need to create multiple components dynamically at runtime and insert them at dynamically created containers.
So at development time I don't know how many containers will be available, where are they placed and which components will be created and in which container they will be inserted. All this should happen at runtime.
With BuildRenderTree I'm able to create HTML at runtime and insert this at a specific place on my page. It is also possible to call OpenComponent on the RenderTreeBuilder but you can't hand over an instance of your component, you only have the possibility to specify the type of your component and Razor will then create an instance of your component. So you don't have the reference to this created instance and can't call methods, etc. of this component. Also everytime the BuildRenderTree method is called the same instance of the previously created component will be used by Blazor.
Is it possible to create a full component at runtime by code, have an instance of this component and place the component on your page? With BuildRenderTree, DynamicComponent and RenderFragment it seems not possible. Is there anything else or should I create an issue so this can be added in a future release?
Beta Was this translation helpful? Give feedback.
All reactions