blazor

How can I deploy a Blazor server-hosted application from Visual Studio 2019

眉间皱痕 提交于 2019-12-10 09:51:16
问题 I am using VS2019 Preview. I have created a "server-hosted" Blazor application using the latest Blazor extension (16.0.19227). This is the variant that contains 3 separate projects... MyApp.Client MyApp.Server MyApp.Shared I can debug this by making MyApp. Server the active project and all works fine but I'm struggling to publish/deploy this to Azure. I have tried the following... Right-click on MyApp.Server in Solution-Explorer Choose "Publish" Go through the wizard to create a new publish

Blazor, ASP.NET Core Hosted vs Server Side in ASP.NET Core

我怕爱的太早我们不能终老 提交于 2019-12-09 14:16:34
问题 I am trying my hands on blazor.Net which is an experimental framework. I already developed a small project in this Framework and its awesome. But after recent update in Blazor Language Service on 14 November I Am seeing owo options in Template selection. First is Blazor (ASP.NET Core Hosted) Second is Blazor (Server Side in ASP.NET Core) There is no information about difference between them, Can anybody tell me what is difference between these two templates and when should choose which one?

How can I access the browsers localStorage in Blazor?

*爱你&永不变心* 提交于 2019-12-08 20:25:44
问题 I want to support JWTs, so I need to keep the token around; is there some facility to access this? Or should we just be registering our own javascript function to access this functionality for now? Edit: per advice, I attempted to use JS interop as : <script> localStorage.setItem("key1", "key1data"); Blazor.registerFunction("readStorage", (key) => { return localStorage.getItem(key); }); </script> @if (jwtKey == null) { <div class="login-panel"> <p>JWT not loaded</p> </div> } else { <div class

How to Separate Code From UI In Blazor.Net

心已入冬 提交于 2019-12-07 23:08:51
问题 Reference to this VisualStudioMagazine article, I am trying to have code in a separate file instead of razor view. I tried: @page "/Item" @using WebApplication1.Shared @using WebApplication1.Client.Services; @inject HttpClient Http @inherits ItemComponent @if (ItemList != null) { <table class="table"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Category</th> <th>Metal</th> <th>Price</th> <th>Quantity</th> </tr> </thead> <tbody> @foreach (var item in ItemList) { <tr> <td>@item.ID</td> <td>@item

How to make an EditForm Input that binds using oninput rather than onchange

拈花ヽ惹草 提交于 2019-12-07 19:44:07
问题 Suppose I want to use an EditForm, but I want the value binding to trigger every time the user types into the control instead of just on blur. Suppose, for the sake of an example, that I want an InputNumber that does this? I've tried using different means that are floating around such as bind-Value:event="oninput" with no success. I was finally able to get more or less what I wanted by copying the AspNetCore source code for InputNumber and overriding / rewriting a few things. Here is my

.NET Core Blazor: How to get the Checkbox value if it is checked?

a 夏天 提交于 2019-12-07 07:32:43
问题 I am trying to find to get the checkbox value if it is checked using Blazor framework, but I couldn't find any method for it so far. When I put the binding in the checkbox, it is always checked. I couldn't figured it out how to get the checked value. This is my code: <input type="checkbox" id="addition" name="math" value="add" bind="@name" /> <label for="addition">Addition</label> 回答1: @page "/registration" @foreach (var club in ClubList()) { <input type="checkbox" @onchange="eventArgs => {

Blazor Textfield Oninput User Typing Delay

家住魔仙堡 提交于 2019-12-07 03:16:45
问题 How can I add a delay to an event (OnInput) in Blazor ? For example, if a user is typing in the text field and you want to wait until the user has finished typing. Blazor.Templates::3.0.0-preview8.19405.7 Code: @page "/" <input type="text" @bind="Data" @oninput="OnInputHandler"/> <p>@Data</p> @code { public string Data { get; set; } public void OnInputHandler(UIChangeEventArgs e) { Data = e.Value.ToString(); } } 回答1: Solution: There is no single solution to your question. The following code

Blazor client side debugging fails

扶醉桌前 提交于 2019-12-07 03:10:38
问题 When trying to debug a Blazor client side app I keep getting the error Debugging connection was closed. Reason: WebSocket disconnected I open Chrome with "%programfiles(x86)%\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 https://localhost:50868/ and do not have any extensions installed in Chrome. I followed the instructions https://docs.microsoft.com/en-us/aspnet/core/blazor/debug?view=aspnetcore-3.0 but no luck. Have you guys ever faced this situation? Any idea on where

How to turn on CircuitOptions.DetailedErrors?

∥☆過路亽.° 提交于 2019-12-06 18:18:05
问题 I'm getting this message in the console when running a server-side Blazor app: Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions in 'CircuitOptions.DetailedErrors' I've had a look at the Blazor error handling documentation, but I can't work out how to actually turn on the detailed errors mentioned in that message? 回答1: More digging on this revealed that there are both non-Blazor specific .NET Core

How does the Blazor WeatherForecast sample work?

ぃ、小莉子 提交于 2019-12-06 14:11:43
The Hello World project template for Blazor includes a Weather Foreacast example (in addition to the Counter increment example). I played around with this to see whats going on behind the scenes. I cant seem to figure it out. Basically, if i comment out the line of code that fetched the weather .json data, then i see "Loading..." indefinitely. Makes sense thus far. But when i run it in its original state, i see "Loading..." then quickly followed by the rendering of the data grid. My confusion is that the rendering of the "Loading..." vs the datagrid is in an if-else statement. So this makes me