Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Jurioli/Blazor.WebForm.Components
ASP.NET Web Forms System.Web.UI.WebControls Razor Components For Blazor WebAssembly, Blazor Hybrid, Blazor Server.
https://github.com/Jurioli/Blazor.WebForm.Components
asp-net asp-net-core blazor blazor-component blazor-components blazor-server blazor-webassembly blazor-webforms components csharp dotnet wasm webassembly webforms
Last synced: 3 months ago
JSON representation
ASP.NET Web Forms System.Web.UI.WebControls Razor Components For Blazor WebAssembly, Blazor Hybrid, Blazor Server.
- Host: GitHub
- URL: https://github.com/Jurioli/Blazor.WebForm.Components
- Owner: Jurioli
- License: mit
- Created: 2021-08-09T14:04:02.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-20T07:53:18.000Z (4 months ago)
- Last Synced: 2024-07-20T08:55:25.112Z (4 months ago)
- Topics: asp-net, asp-net-core, blazor, blazor-component, blazor-components, blazor-server, blazor-webassembly, blazor-webforms, components, csharp, dotnet, wasm, webassembly, webforms
- Language: C#
- Homepage:
- Size: 6.4 MB
- Stars: 39
- Watchers: 4
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazor - Blazor.WebForm.Components - ![stars](https://img.shields.io/github/stars/Jurioli/Blazor.WebForm.Components?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/Jurioli/Blazor.WebForm.Components?style=flat-square&cacheSeconds=86400) ASP.NET Web Forms System.Web.UI.WebControls Razor Components For Blazor WebAssembly. [Demo](https://blazorwebformdemo.github.io/). (Libraries & Extensions / Component bundles)
README
# Blazor.WebForm.Components
ASP.NET Web Forms System.Web.UI.WebControls Razor Components For Blazor WebAssembly, Blazor Hybrid, Blazor Server.Demo:
[![NuGet version (Blazor.WebForm.Components)](https://img.shields.io/nuget/v/Blazor.WebForm.Components)](https://www.nuget.org/packages/Blazor.WebForm.Components/)
@using System.Web.UI
@using System.Web.UI.WebControls
@page "/fetchdata-gridview"
@inherits ControlComponent
@inject HttpClient Http<div>
<h1>Weather forecast (GridView)</h1>
<asp.Button Text="Load Data" OnClick="this.Button_Click"></asp.Button>
<hr />
<asp.Label @ref="this.label"></asp.Label>
<br />
<asp.GridView @ref="this.gridview" AutoGenerateColumns="false" CssClass="table" AllowPaging="true"
PageSize="2" OnPageIndexChanging="this.GridView_PageIndexChanging">
<Columns>
<asp.BoundField HeaderText="Date" DataField="Date" DataFormatString="{0:yyyy/M/d}"></asp.BoundField>
<asp.BoundField HeaderText="Temp. (C)" DataField="TemperatureC"></asp.BoundField>
<asp.BoundField HeaderText="Temp. (F)" DataField="TemperatureF"></asp.BoundField>
<asp.BoundField HeaderText="Summary" DataField="Summary"></asp.BoundField>
</Columns>
</asp.GridView>
</div>@code {
private WeatherForecast[] forecasts;
private Label label;
private GridView gridview;protected async void Button_Click(object sender, EventArgs e)
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");label.Text = DateTime.Now.ToString();
gridview.PageIndex = 0;
gridview.DataSource = forecasts;
gridview.DataBind();this.RequestRefresh();
}protected void GridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gridview.PageIndex = e.NewPageIndex;
gridview.DataBind();
}public class WeatherForecast
{
public DateTime Date { get; set; }public int TemperatureC { get; set; }
public string Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}
BulletedListDropDownListImageMapMultiViewTextBox
ButtonFileUploadLabelPanelWizard
CalendarHiddenFieldLinkButtonPlaceHolder
CheckBoxHyperLinkListBoxRadioButton
CheckBoxListImageLiteralRadioButtonList
ComboBoxImageButtonLocalizeTable
DataListListView
DataPagerRepeater
DetailsView
FormView
GridView
CompareValidatorValidationSummary
CustomValidator
RangeValidator
RegularExpressionValidator
RequiredFieldValidator
### Blazor Server
Add CircuitHandler service to Program.cs
builder.Services.AddScoped<CircuitHandler, ScriptManagerCircuitHandler>();
using Microsoft.AspNetCore.Components.Server.Circuits;
using System.Web.Hosting;
namespace Server
{
public class ScriptManagerCircuitHandler : CircuitHandler
{
private readonly IServiceProvider _serviceProvider;
public ScriptManagerCircuitHandler(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public override Task OnCircuitOpenedAsync(Circuit circuit, CancellationToken cancellationToken)
{
ScriptManagerHost.AddScoped(_serviceProvider);
return base.OnCircuitOpenedAsync(circuit, cancellationToken);
}
public override Task OnCircuitClosedAsync(Circuit circuit, CancellationToken cancellationToken)
{
ScriptManagerHost.RemoveScoped(_serviceProvider);
return base.OnCircuitClosedAsync(circuit, cancellationToken);
}
}
}