I have a Differ_Board.razor file with the following content:
<div class="dsb-container" draggable="true">
<BoardHeader></BoardHeader>
</div>
I am using the following method to dynamically add the Dash_Channel_Info variable:
RenderFragment<DashBord_Info> renderFragment = value => builder =>
{
builder.OpenComponent(0, Type.GetType($"{namespaceName}.{dashboardType}"));
builder.AddAttribute(1, "Dash_Channel_Info", value);
builder.CloseComponent();
};
I have confirmed that the variable is correctly passed, but <BoardHeader></BoardHeader>
triggers the following error:
Unhandled exception rendering component: InvalidCharacterError: Failed to execute 'setAttribute' on 'Element': ');"' is not a valid attribute name.
The error disappears when I remove builder.AddAttribute(1, "Dash_Channel_Info", value);
.
But I need to use AddAttribute for dynamic generation.
I need assistance in resolving this issue. Thank you.
user24790201 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.