How do I save string to session storage in Blazor Server in the _Host.cshtml file

Like the title says, I am wondering how to save strings to session storage in Blazor Server in the _Host.cshtml file to then read them in the other Blazor pages. I am getting data from a LiteDB database. I tries using the Blazored.SessionStorage package, but I got an error, without a direct code?, it just… Read More How do I save string to session storage in Blazor Server in the _Host.cshtml file

How to use querystring within Blazor controller

I have the following code within my Blazor Server Project: using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Mvc; using RouteAttribute = Microsoft.AspNetCore.Mvc.RouteAttribute; namespace ProjectName.Controllers { [Route("/getfile")] [ApiController] [Authorize] public class ReturnFileController : ControllerBase { [Parameter] [SupplyParameterFromQuery] public int? fileId { get; set; } [HttpGet()] public async Task<IActionResult> GetFile() { File file = GetFileAsync(fileId); } } } But… Read More How to use querystring within Blazor controller

Blazor C# – Map and add to List while incrementing through List

I have currently written the following code in Blazor while attempting to populate and then return a list. public async Task<IEnumerable<LocationDTO>> GetStuff(List<StuffDTO> stuff) { List<LocationDTO> locations = new List<LocationDTO>(); stuff.ForEach(stuff=> { locations = _mapper.Map<IEnumerable<Location>, IEnumerable<LocationDTO>>(_db.table.Where(u => u.LocationNumber == stuff.Location.ToString()).Distinct()).ToList(); }); return locations; } But while testing the code, I noticed that I was only getting… Read More Blazor C# – Map and add to List while incrementing through List

'Some services are not able to be constructed' Blazor server app

I am trying to write a simple Blazor Server app (which I have done before) and I am getting a ‘System.AggregateException’ error when the app tries to build. Some services are not able to be constructed (Error while validating the service descriptor ‘ServiceType: CrispyAcers.Services.IFarmService Lifetime: Transient ImplementationType: CrispyAcers.Services.FarmService’: Unable to resolve service for type ‘Microsoft.EntityFrameworkCore.IDbContextFactory`1[CrispyAcers.Models.FarmContext]’… Read More 'Some services are not able to be constructed' Blazor server app

Blazor: How to customise colour variables in _root.scss?

It seems that the generated project already has lots of colour variables like –bs-body-bg. Dev.tools say it is in _root.scss, but that file does not seem to exist, and I suspect it is inside of bootstrap.in.css. Can I customise those existing colour variables? >Solution : It’s coming from scss. You should have other _XXX.scss. SCSS… Read More Blazor: How to customise colour variables in _root.scss?

In my Blazor server app, I have a problem when programming the rows of a table dynamically. What could be the problem?

I have following razor page in my Blazor server app (Code-1). In this razor page I have two dynamic tables. In the first table the CNC AX names of a CNC machine are listed (AX0…AX7). If the user clickes to the axis name, the axis parameters belonging to this axis shall be listed in the… Read More In my Blazor server app, I have a problem when programming the rows of a table dynamically. What could be the problem?

How to get configuration.section on Blazor Server project created with NetCore 6?

On previous Blazor Server projects, that have the Startup.cs I am using this code to retrieve configuration: Startup.cs { public IConfiguration Configuration { get; } public Startup(IConfiguration configuration){Configuration = configuration;} … StripeConfiguration.ApiKey = Configuration.GetSection("Stripe")["ApiKey"]; StripeConfiguration.ClientId = Configuration.GetSection("Stripe")["ClientId"]; …. } But it does not work on new projects created with NetCore 6, so I copied the… Read More How to get configuration.section on Blazor Server project created with NetCore 6?

Blazor CS0103: "The name 'lines' does not exist in the current context

Hello stackoverflow community, I am getting error CS0103 I’ve searched google but couldn’t find an answer sorry if this is a bad question I’m new with Blazor. I’m Trying to make a table from a comma seperated file. @page "/fetchdata" <PageTitle>Keyword analytics</PageTitle> @using BlazorApp.Data <h1>Keyword Analytics</h1> <table class="table"> <thead> <tr> <th>Keyword</th> <th>Volume</th> <th>Competition</th> <th>Results</th> </tr>… Read More Blazor CS0103: "The name 'lines' does not exist in the current context