blazor

C# Blazor: How to use @typeparam in Code behind? (with workaround)

▼魔方 西西 提交于 2020-04-13 03:56:08
问题 In a Blazor .razor file you can use @typeparam MyType to use generic parameters . For example: MyComponent.razor @typeparam MyType <SomeHtml /> @code { [Parameter] public List<MyType> MyList{ get; set; } } So you can call: <MyComponent MyType="MyTypeABC" MyList="@MyData.MyList" /> But I prefer code behind (razor.cs), how can I use a parameter for type like @typeparam MyType in the razor.cs file? My current workaround is: MyComponent.razor @inherits MyComponentCode<MyType> @typeparam MyType

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

 ̄綄美尐妖づ 提交于 2020-04-12 16:57:25
问题 In Blazor I have an <a> element that has both a href and an onclick method: <a href="" onclick="@(() => ChangePage(_someObject))">Test</a> onclick calls this method: private bool ChangePage(object objectToDisplay) { _currentObject = objectToDisplay; StateHasChanged(); return false; } Normally in JavaScript returning false from the event method stops the subsequent navigation to the link in the href but this doesn't seem to be working with my code above. How can I stop Blazor changing the page

Maintaining SynchronizationContext for nested (not first or last) methods in Blazor

痞子三分冷 提交于 2020-04-11 18:21:40
问题 Using the default project that loads with Visual Studio 2019 when you create a new blazor server-side project in .NetCore 3.1, consider the following example (a slight change to their own counter example page): <button class="btn btn-primary" @onclick="SingleMethodUpdate">Click Me</button> <label>Update from same method: @result</label> <button class="btn btn-primary" @onclick="NestedMethodUpdate">Click Me</button> <label>Update from nested method: @nestedResult</label> And the code-behind to

Visual Studio 2019 where to find WebAssembly template for .net core 3.1

会有一股神秘感。 提交于 2020-04-11 11:53:32
问题 I'm using very latest (16.4.2, dated 8th Jan 2020) Visual Studio 2019. When I tried to create a Blazor WebAssembly solution, although the description for 'blazor app' included the words 'server or webassembly', when I got to the create page, only Server option was available and it successfully creates Core 3.1 application. I assumed latest version would be there, so I went to the Visual Studio marketplace website and there were no Blazor extensions to be found, so looking on the internet I

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies in IIS

限于喜欢 提交于 2020-04-10 07:50:46
问题 I try to run a Blazor application. Web.Server runs .NET Core 3.0 Web.Client runs .NET Standard 2.0 Web.Shared runs .NET Standard 2.0 After publishing and uploading the application to IIS i get this error: HTTP Error 500.31 - ANCM Failed to Find Native Dependencies Common solutions to this issue: The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found. Event Viewer contains this error message: HTTP Error 500.31 - ANCM Failed to Find Native Dependencies When I

How to place submit button for a Blazor EditForm outside of the component

坚强是说给别人听的谎言 提交于 2020-04-10 06:33:11
问题 The Blazor documentation's Form Validation example has a submit button component within the EditForm component: <EditForm Model="@starship" OnValidSubmit="@HandleValidSubmit"> <DataAnnotationsValidator /> <ValidationSummary /> <p> <label for="identifier">Identifier: </label> <InputText id="identifier" bind-Value="@starship.Identifier" /> </p> Snip.... <button type="submit">Submit</button> Snip... </EditForm> Is there anyway to place that submit button outside of the EditForm tags and still

How to place submit button for a Blazor EditForm outside of the component

烈酒焚心 提交于 2020-04-10 06:32:07
问题 The Blazor documentation's Form Validation example has a submit button component within the EditForm component: <EditForm Model="@starship" OnValidSubmit="@HandleValidSubmit"> <DataAnnotationsValidator /> <ValidationSummary /> <p> <label for="identifier">Identifier: </label> <InputText id="identifier" bind-Value="@starship.Identifier" /> </p> Snip.... <button type="submit">Submit</button> Snip... </EditForm> Is there anyway to place that submit button outside of the EditForm tags and still

Bootstrap Blazor 组件库

試著忘記壹切 提交于 2020-04-08 18:03:19
项目介绍 Blazor 是一个使用 .NET 生成交互式客户端 Web UI 的框架: 使用 C# 代替 JavaScript 来创建丰富的交互式 UI。 共享使用 .NET 编写的服务器端和客户端应用逻辑。 将 UI 呈现为 HTML 和 CSS,以支持众多浏览器,其中包括移动浏览器。 使用 .NET 进行客户端 Web 开发可提供以下优势: 使用 C# 代替 JavaScript 来编写代码。 利用现有的 .NET 库生态系统。 在服务器和客户端之间共享应用逻辑。 受益于 .NET 的性能、可靠性和安全性。 始终高效支持 Windows、Linux 和 macOS 上的 Visual Studio。 以一组稳定、功能丰富且易用的通用语言、框架和工具为基础来进行生成。 本项目是利用 Bootstrap 样式进行封装的 UI 组件库 组件 Blazor应用基于组件。 Blazor 中的组件是指 UI 元素,例如页面、对话框或数据输入窗体。 组件是内置到 .NET 程序集的 .NET 类,用来: 定义灵活的 UI 呈现逻辑。 处理用户事件。 可以嵌套和重用。 可以作为 Razor 类库或 NuGet 包共享和分发。 项目截图 内置组件 码云地址: https://gitee.com/LongbowEnterprise/BootstrapBlazor 演示地址: http:/

Bootstrap Blazor 组件库

人盡茶涼 提交于 2020-04-08 17:52:23
项目介绍 Blazor 是一个使用 .NET 生成交互式客户端 Web UI 的框架: 使用 C# 代替 JavaScript 来创建丰富的交互式 UI。 共享使用 .NET 编写的服务器端和客户端应用逻辑。 将 UI 呈现为 HTML 和 CSS,以支持众多浏览器,其中包括移动浏览器。 使用 .NET 进行客户端 Web 开发可提供以下优势: 使用 C# 代替 JavaScript 来编写代码。 利用现有的 .NET 库生态系统。 在服务器和客户端之间共享应用逻辑。 受益于 .NET 的性能、可靠性和安全性。 始终高效支持 Windows、Linux 和 macOS 上的 Visual Studio。 以一组稳定、功能丰富且易用的通用语言、框架和工具为基础来进行生成。 本项目是利用 Bootstrap 样式进行封装的 UI 组件库 组件 Blazor应用基于组件。 Blazor 中的组件是指 UI 元素,例如页面、对话框或数据输入窗体。 组件是内置到 .NET 程序集的 .NET 类,用来: 定义灵活的 UI 呈现逻辑。 处理用户事件。 可以嵌套和重用。 可以作为 Razor 类库或 NuGet 包共享和分发。 项目截图 内置组件 码云地址: https://gitee.com/LongbowEnterprise/BootstrapBlazor 演示地址: http:/

System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.'

▼魔方 西西 提交于 2020-04-07 07:09:51
问题 I've download new blazor webassembly project template with dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3 Next I created in Visual Studio 2019 new Blazor WebAssembly project with enabled "Asp.Net Core hosted" and "authenthication". I named it "27MarchTemplate" Now I Run project and get System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.' at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.get