blazor

Getting “NETSDK1045 The current .NET SDK does not support .NET Core 3.0 as a target” when using Blazor Asp.NetCore hosted template

瘦欲@ 提交于 2019-12-04 14:48:41
I've installed the preview of .NetCore 3.0 and tried to run the blazor template Blazor (ASP.NET Core hosted) in Visual Studio 2019: The error that occured, was the following: NETSDK1045 The current .NET SDK does not support .NET Core 3.0 as a target. Either target .NET Core 2.2 or lower, or use a .NET SDK version that supports .NET Core 3.0. Following the comment under https://github.com/dotnet/cli/issues/8743#issuecomment-371519751 , I managed to resolve the problem by installing the x86 version of the .NET Core 3.0 additionally to the x64 version. The build worked after restarting Visual

Auto inject javascript in blazor application

一曲冷凌霜 提交于 2019-12-04 10:49:52
I'm developing a Blazor extension library. One thing in this library would be the reuse of the javascript alert() method. I know how to do this, this involves adding this in a .cshtml page: <script> Blazor.registerFunction('Alert', (message) => { alert(message); }); </script> and this in my code: public void Alert(string message) { RegisteredFunction.Invoke<object>("Alert", message); } I would like the javascript part somehow to be auto injected in the html if you use my package (or maybe always). Not sure if this is possible (yet) Any ideas on this? Edit Since blazor 0.2 there is a more

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

我与影子孤独终老i 提交于 2019-12-03 23:26:51
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? JohnB In the server-side hosting model, Blazor is executed on the server from within an ASP.NET Core app

Blazor: Implementing 404 not found page

末鹿安然 提交于 2019-12-03 08:28:49
I'd like to implement a page internal to my application that appears when the blazor router is unable to find a matching route. Currently, all requests are routing to index.html so I'm unable to handle errors through iis as I may normally. If I enter an invalid route, I will be shown a blank page (which is actually index.html ) and receive a console error: 'Router' cannot find any component with a route for '/some/Nonexistent/Route'. It seems like I should be able to handle this since the blazor router is able to recognize that there is no route defined which matches the requested route

Using SignInManager in server-side Blazor

余生颓废 提交于 2019-12-02 22:07:20
问题 Is it possible to use SignInManager without having some HTTPContext ? I'm making a Blazor server-side app and I need to make end-users signed in using PasswordSignInAsync() method of SignInManager . If there is other ways to do it with cookies or something else, I'll take it too, as long they are "clean" methods. If I could get also an explanation on how to configure for Startup.cs the solution, it will be perfect. 回答1: I'd strongly suggest that you use the Identity authentication system in

Authorization policies in blazor server side

流过昼夜 提交于 2019-12-02 14:58:26
问题 I'm trying to find docs on the blazor server side equivalent of asp.net core authorization policies, but can't seem to find anything. Can someone tell me what the mechanism is for authorization in blazor server side? 回答1: No authentication and authorization for Blazor exist right now. The Asp.Net team is currently working on it... You may read here the whole story: https://github.com/aspnet/AspNetCore/issues/4048 Hope this helps... 回答2: The latest preview -6 of .NET Core 3 has introduced

Is it possible to get a list of RenderFragments when overriding BuildRenderTree?

 ̄綄美尐妖づ 提交于 2019-12-02 08:33:38
I'm wondering if it's possible to reference child elements in the ChildContent parameter of a component. I can pass values from parent components to children explicitly or by using a cascading parameter, but there is no great way for a parent component to "know" about elements inside the ChildContent RenderFragment . A possible use-case for this would be a UIList component that gets the number of UIListItems that have been added to the UIList component during the render process. I've attempted to override the BuildRenderTree method on my component to manually manipulate ChildContent

For loop not returning expected value - C# - Blazor

蓝咒 提交于 2019-12-02 05:06:34
问题 Using Blazor, I am creating a pagination feature for my project. The main concept is just using linq's .Skip() and .Take(), I will only take the list items for the page clicked from the list. The code that creates the pagination buttons: (E.G: 1,2,3) <ul class="pagination float-center"> @for (int i = 0; i < Math.Ceiling((decimal)articleService.ReturnAll().Count() / numPerPage); i++) { <li class="page-item"><a class="page-link" onclick="@(() => ReturnPage(i))">@i</a></li> } </ul> I'm fine

Is this possible to integrate jQuery UI components inside Blazor application?

牧云@^-^@ 提交于 2019-12-02 04:50:59
问题 I want to integrate the jQuery UI component within the Blazor client-side application. The Spinner component looks better in jQuery UI. is this possible? how to integrate it? I expect to integrate this Spinner component into my Blazor client-side application? https://jqueryui.com/spinner/ 回答1: This is the way to create a wrapper for a JQuery or JS control: 1.- Enclose JS behavior in functions: <script> var spinner = null; window.myWrapperKSUIfunctions = { initialize: function () { spinner = $

For loop not returning expected value - C# - Blazor

喜你入骨 提交于 2019-12-02 00:41:34
Using Blazor, I am creating a pagination feature for my project. The main concept is just using linq's .Skip() and .Take(), I will only take the list items for the page clicked from the list. The code that creates the pagination buttons: (E.G: 1,2,3) <ul class="pagination float-center"> @for (int i = 0; i < Math.Ceiling((decimal)articleService.ReturnAll().Count() / numPerPage); i++) { <li class="page-item"><a class="page-link" onclick="@(() => ReturnPage(i))">@i</a></li> } </ul> I'm fine withing using 0 indexing here for my pagination. This above code creates the buttons that when pressed (say