tagged [blazor]

Recompile .razor files on save for Blazor WASM

Recompile .razor files on save for Blazor WASM Is there a way to make Blazor Webassembly recompile `.razor` files when they're changed/updated and then saved? I'm used to this happening both in tradit...

Blazor link - disable href if there's an onclick method

Blazor link - disable href if there's an onclick method In Blazor I have an `` element that has both a `href` and an `onclick` method: `onclick` calls this method: Normally in Ja

11 Jun at 08:30

How do I write Blazor HTML code inside the @code block?

How do I write Blazor HTML code inside the @code block? How can I write Blazor HTML code within a function inside of the `@code` block? Consider the following code: It d

8 Sep at 07:25

Creating and Reading Cookies on Blazor Server Side

Creating and Reading Cookies on Blazor Server Side What is the easiest way to create and read cookies on Blazor server side. It seems all the solutions out there is for Blazor Web-assembly, and whenev...

Blazor - How to create Components dynamically

Blazor - How to create Components dynamically I want to test if it was possible to create Blazor components dynamically. I can't find any way to do this. I have experimented a bit with some dynamic co...

11 May at 22:4

Breakpoints won't hit in Blazor Webassembly project, ASP.NET Core 3.1,

Breakpoints won't hit in Blazor Webassembly project, ASP.NET Core 3.1, Breakpoints won't hit in ASP.NET Core 3.1, Blazor Webassembly project. I have a solution with a single Blazor Webassembly project...

Difference between @bind and @bind-value

Difference between @bind and @bind-value What is the difference of using `@bind` and `@bind-value`? I made this simple example, and testing it in the browser, I didn't see any difference. ``` @@bind @...

3 Oct at 15:8

Blazor TwoWay Binding on custom Component

Blazor TwoWay Binding on custom Component I'm creating a blazor server side app and have problems to bind a value between two custom components. I've looked through different example of how the bind o...

Get Child Component binded values in Parent Component in Blazor

Get Child Component binded values in Parent Component in Blazor Lets Say Child Component called cinput.cshtml is and Parent Component called pform.cshtml ``` @functions{ string email; public void onsu...

9 Apr at 21:45

so many comment tags in blazor rendered html file

so many comment tags in blazor rendered html file I was wondering if anyone knows why there are so many empty comment tags `` in blazor rendered HTML file I installed 2 projects, and when I started th...

6 Oct at 15:36

Blazor - show confirmation dialog before delete/update?

Blazor - show confirmation dialog before delete/update? In the following Blazor (server-side) code snips. How to prompt the confirmation dialog? ``` @foreach (var r in lists) { var s = r.ID; ...

5 Nov at 21:38

Why Return Base Method With Blazor OnInitialized Method

Why Return Base Method With Blazor OnInitialized Method I am seeing more and more examples of OnInitialized and OnInitializedAsync() returning base.OnInitialized[Async]. But Why? The examples on the M...

30 May at 10:51

Blazor component : refresh parent when model is updated from child component

Blazor component : refresh parent when model is updated from child component I'm using Server-side Blazor components in ASP.NET Core 3 preview 4. I have a parent component, and child components, using...

@attribute [AllowAnonymous] in Blazor server-side component has no effect

@attribute [AllowAnonymous] in Blazor server-side component has no effect I have created a fresh Blazor server-side project with .NET Core 3.0 and have closed down the application for non-authenticate...

Scroll to specified part of page when clicking top navigation link in Blazor

Scroll to specified part of page when clicking top navigation link in Blazor How can I make a simple "jump to" part of already loaded page in Blazor? Like this in HTML: Ideally I also want to have it ...

15 Mar at 16:19

Suppress Blazor css ::deep warning

Suppress Blazor css ::deep warning In a css file of an asp.net Blazor app when I use `::deep` VS emits a warning "Validation (CSS 4.0): "::deep" is not a valid pseudo-element." That might be true for ...

24 Aug at 19:36

How to set consent cookie in Blazor Server

How to set consent cookie in Blazor Server I have a Blazor 3.1 App with Identity where I want to implement a cookie consent banner. In classic ASP .NET Core, there is a nice template for a cookie cons...

How to connect Blazor WebAssembly to DataBase

How to connect Blazor WebAssembly to DataBase I recently started developing a Blazor WebAssembly app, and now I'm settling on a database connection. All lessons and instructions say that you need to e...

Assembly build version at runtime in blazor wasm app

Assembly build version at runtime in blazor wasm app What is the best way to get build version number at runtime in web assembly client-side blazor app? In server side version I was able to use `Assem...

21 Sep at 21:2

How to store session data in server-side blazor

How to store session data in server-side blazor In a server-side Blazor app I'd like to store some state that is retained between page navigation. How can I do it? Regular ASP.NET Core session state d...

How to redirect to a different route in Blazor Server-side

How to redirect to a different route in Blazor Server-side In Blazor Client a redirection can be achieved using This does however not work in a Blazor Server project, as it generates the following err...

22 Apr at 14:54

How to put the "Display Name" in a label on a Blazor page?

How to put the "Display Name" in a label on a Blazor page? I have the following model: In standard Razor I would do something like the following to get the "Display Name": but that doesn't seem to wor...

6 Sep at 20:59

Calling async methods in Blazor view

Calling async methods in Blazor view I have a server-side blazor client and I'm trying to modify the MainLayout razor page by having a Login check. I'm currently using Blazored for localstorage saving...

12 Oct at 22:3

Blazor vs Razor

Blazor vs Razor With the invention of Blazor, I'm wondering if there are significant efficiencies (both in creation of code and in the actual compilation / execution of code) between these two languag...

11 May at 22:18

Blazor how to pass arguments to onclick function?

Blazor how to pass arguments to onclick function? I'd want to make button `onclick` function that takes some input. But for some reason it throws an error: `Argument "1": Cannot convert from void to s...

21 Jan at 22:54