Questions tagged [razor-components]

Do not use this. Was re-renamed to blazor-serverside. Razor Components is a way to build interactive client-side web UI with .NET

91 questions
42
votes
2 answers

Execute async method on button click in blazor

I created a "Razor Components" project. I am trying to execute an asynchronous method when pressing a button, but could not figure out the syntax yet. This is my Index.razor: @page "/" @inject GenericRepository PersonRepository @foreach…
ˈvɔlə
  • 9,204
  • 10
  • 63
  • 89
25
votes
1 answer

Blazor Component parameter should not be set outside of its component

I am learning Blazor. I have no experience with component-based programming. I have two components: a DateRangePicker and a RadzenCheckBox.
Junaid
  • 941
  • 2
  • 14
  • 38
20
votes
2 answers

Razor components vs View Components

I recently upgraded from Asp .NET Core 2.2 to 3.1 and can use Razor Components in razor pages. They look basically like View Components except it uses blazor and everything on the same file. I tried to search but i haven't read anything on…
Jackal
  • 3,359
  • 4
  • 33
  • 78
20
votes
4 answers

How to pass a parameter to razor component in server-side Blazor?

How can I pass parameter into razor component? So far I tried @(await Html.RenderComponentAsync(RenderMode.ServerPrerendered, new { id= 100})) But I receive an error InvalidOperationException: Prerendering server components with …
mko
  • 6,638
  • 12
  • 67
  • 118
16
votes
5 answers

Blazor (Razor Components) Refresh Child Component from Parent Component

I have a simple child Blazor component (MyModal) like so: @code { [Parameter] string Title { get; set; } [Parameter] RenderFragment BodyTemplate { get; set; } } In my Parent…
aherrick
  • 19,799
  • 33
  • 112
  • 188
6
votes
1 answer

Developing Blazor Razor component in VS with dual screens

Is there a way to open Razor component in Visual Studio with environment with dual screens . I'll love to have markup on one screen and @code {} section on other. While MVC developing usually markup is on one screen while JS is on other. Switching…
adopilot
  • 4,340
  • 12
  • 65
  • 92
6
votes
0 answers

Razor runtime recompilation does not seems to work with *.razor component files

I'm testing the new Razor Components (aka. Server Side Blazor) and I'm finding the need to stop the project, edit, recompile and restart the server, very time consuming. I want to edit the *.razor files, save, press F5 on the browser, and done. I…
Guilherme
  • 5,143
  • 5
  • 39
  • 60
5
votes
2 answers

Asp.net core 3.1 can't find Razor component to render

Im trying to integrate Blazor into an existing asp.net core 3.1 application. All tutorials I have seen, says that after doing the correct setup in the web project, you should be able to do this in any cshtml file: @(await…
Christian
  • 1,080
  • 1
  • 20
  • 37
5
votes
1 answer

No Razor Components Template in Visual Studio 2019

I just installed Visual Studio 2019 (full version) and .NET Core 3.0 Preview 3 so I can test Razor Components. On Get started with Razor Components page it says that prerequisites are .NET Core Preview 3 and VS 2019 Preview. I figured that full…
4
votes
3 answers

Blazor - What is the correct way to extend another component?

I'm using MudBlazor component library. In order to show loading on form buttons, the documentation guides like this: @if (_processing) …
Parsa99
  • 307
  • 1
  • 13
4
votes
0 answers

Razor Components and Tag Helpers, Why? How?

Reading the latest documentation for ASP.Net Core 3.1, it is now recommended to use Razor Components over View Components. From 1,000 feet, this looks like a great idea as there is a single-file now instead of a "controller" and a default "view". …
4
votes
2 answers

How do I change the title and other html-elements in the head of a HTML-document in Razor Components?

I'm fairly new to Razor Components and I would like to change the title and other data inside the HTML-document-head depending on what page a user visits (e.g. if a user visits the product page of product X, I want to change the title and other…
3
votes
2 answers

.NET6 Blazor @typeparam where constraint ERROR RZ1017

I have this directive on top of razor component file but it throws an error RZ1017 @typeparam TEntity where TEntity : IEntity What I missed? Basde from .NET 6 Blazor
Ronald Abellano
  • 774
  • 10
  • 34
3
votes
0 answers

Blazor / How to check if the value of InputText exists in database?

Blazor server app (.Net 5.0), Dapper On my (Razor) form, I have a field "Name" that I need to check at entry time. On page load, OnInitializedAsync() I fetch all names from the database as List names. And then when the user inputs a new name…
3
votes
0 answers

How to set layout for a Blazor component programmatically?

In Razor View there is a property named Layout that allows me to set the layout for that view with code, simply just like this @{ Layout = "_MyLayout"; } Now in Blazor component is there something similar that allows me to set the layout for my…
Ray
  • 12,101
  • 27
  • 95
  • 137
1
2 3 4 5 6 7