Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

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);
}
}


  • Standard Toolbox



  • BulletedListDropDownListImageMapMultiViewTextBox


    ButtonFileUploadLabelPanelWizard


    CalendarHiddenFieldLinkButtonPlaceHolder


    CheckBoxHyperLinkListBoxRadioButton


    CheckBoxListImageLiteralRadioButtonList


    ComboBoxImageButtonLocalizeTable


  • Data Toolbox



  • DataListListView


    DataPagerRepeater


    DetailsView


    FormView


    GridView


  • Validation Toolbox



  • 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);
    }
    }
    }