Questions tagged [blazor-component]
53 questions
6
votes
2 answers
Blazor: Pass a function that takes parameters to a component and call it from it
I'm trying to split my Blazor Server project into components in order to make it more manageable.
I want my component to have a function passed in as a parameter to it. The function takes a string parameter and it is called with different names from…

ofido
- 78
- 2
- 5
6
votes
2 answers
CSS isolation in blazor-server components
with the new .NET 5 preview CSS isolation comes in blazor.
Does anybody know, is it possible to use the CSS isolation in blazor server?
I have play a lot around, but in my blazor server app CSS isolation doesn't work.
Or is this feature only…

Daniel Weber
- 171
- 1
- 7
5
votes
2 answers
When to have more than one root components in Blazor?
In the main method of dotnet core blazor web assembly app there is a WebAssemblyHostBuilder class which builds the host for the blazor application.
In that class there is a public property called RootComponentMappingCollection which one can add the…

Elder1360
- 83
- 1
- 7
4
votes
3 answers
Blazor - How to make child component show validation messages?
I need to display validation messages if a nested-component is not properly filled in. The component is consumed by other parent-components and they need to get feedback on whether there are validation issues.
I have tried the following code for the…

jakubiszon
- 3,229
- 1
- 27
- 41
2
votes
0 answers
Scoped CSS files are not applying their styles in Razor Class Library Components
A component in a Razor Class Library has it's scoped CSS file, but the classes in there are not being applied. Even the CSS class name my-component found in the out-of-the-box component Component1.razor does not apply to its styles defined in the…

Russell Chidhakwa
- 339
- 2
- 5
- 16
2
votes
1 answer
Blazor - Passing a function to dynamic component
I'd like to have a fluent communication between components via DynamicComponent in Blazor.
Thus I'd like to know whether its possible to pass a function to a DynamicComponent since now it doesn't know that the would be rendered components need a…

Zigzagas
- 73
- 1
- 7
2
votes
1 answer
Blazor server side SPA: Component state after reloading component
The problem is the following: I have a component which holds a table and some searchfields for the table. If I do a search and after that I go to another page and back to the table page, all values of the table component are resetted. Like the…

V. Braz
- 35
- 4
2
votes
1 answer
Blazor component not calling OnInitializedAsync on statechange, chained data-fetching
Im new to blazor and still learning, and I have a state-problem with my dashboard.
I have one component that fetches the dashboard and the panels:
@if (Data == null)
{
return;
}
@foreach (var…

svinpals
- 33
- 4
1
vote
1 answer
Razor component value not updating inside LocationChanged event handler
Razor component value is not updating inside LocationChanged event handler.
I have created a Razor component Breadcrumb.razor. I'm using this component inside my MainLayout.razor page.
I need to update my breadcrumb values on…

habib
- 2,366
- 5
- 25
- 41
1
vote
0 answers
Blazor best way to broadcast a generic change to other components
I have a series of nested components like this:
LocationDetails
NodeWithChildren
NodeDetails
PhotoGallery (shows images of current node)
PhotoGalleryZoom (modal dialog)
ImageEditor
The NodeWithDetails…

iCollect.it Ltd
- 92,391
- 25
- 181
- 202
1
vote
4 answers
Blazor Component is not re-rendering after data is loaded
I have created a DropDownList box component which is bound to a long list of vendors.
ContractVendorSelect.razor
@if (IsLoaded)
{

Gary O. Stenstrom
- 2,284
- 9
- 38
- 59
1
vote
1 answer
Blazor Server best practices about state management and routing
I have one page on a Blazor Server app that has multiple child components and I could get some input about best practices about handling different routes, and state management for a somewhat complex page/component.
My page lookssimilar to the image…

vander
- 138
- 6
1
vote
0 answers
blazor complex page - best practice to split into small components
Problem
I am developing a complex blazor page (with a svg editor, image selector, image annotation editor, etc.)
So I decided to split the page content into many blazor components (eg. ImageSelectorComponent, ImageEditorComponent and…

florian03
- 21
- 4
1
vote
3 answers
How do I instantiate a C# service and use its data in a Blazor component
I am using Blazor and I am a beginner.
Currently I have several Blazor components that all need the same JSON data (data fetched from one URL, e.g., http://localhost/todo)
Instead of fetching the same URL inside all my components and duplicating my…

elektra
- 55
- 2
- 19
1
vote
1 answer
Blazor and JavaScript functions not recognized
In my Blazor project, I have a lot of tabs to display. I was looking for a solution and I found a nice JavaScript implementation with jQuery that is working for desktop and mobile. Here an example of the jQuery implementation
It is working quite…

Enrico
- 3,592
- 6
- 45
- 102