Skip to content

Commit

Permalink
2.2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurioli committed Jun 23, 2022
1 parent e38131e commit 8e14978
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 4 deletions.
Binary file removed Blazor.WebForm.Components.2.0.1.6.nupkg
Binary file not shown.
Binary file added Blazor.WebForm.Components.2.2.0.1.nupkg
Binary file not shown.
22 changes: 21 additions & 1 deletion Blazor.WebForm.Components/Base/ControlComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,14 @@ protected void RequestRefresh(TemplateControl control)

protected virtual void OnSubmit(object sender, EventArgs e)
{
this.SendMessage("RequestLoadPostData", this.TemplateControl);
if ((this.ClientScript as IPlatformClientScript).InProcess)
{
this.SendMessage("RequestLoadPostData", this.TemplateControl);
}
else
{
this.SendMessage("RequestLoadPostDataAsync", this.TemplateControl);
}
}

[MessageNotifyMethod]
Expand All @@ -417,6 +424,19 @@ protected void RequestLoadPostData(TemplateControl control)
}
}

[MessageNotifyMethod]
protected async Task RequestLoadPostDataAsync(TemplateControl control)
{
if (_disposed || control != this.TemplateControl)
{
return;
}
if (this.Control is IPostBackDataHandler)
{
await this.LoadPostDataAsync(false);
}
}

public static implicit operator TControl(ControlComponentBase<TControl> component)
{
return component.Control;
Expand Down
4 changes: 2 additions & 2 deletions Blazor.WebForm.Components/Blazor.WebForm.Components.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Blazor.WebForm.Components.pfx</AssemblyOriginatorKeyFile>
<Version>2.0.1.6</Version>
<Version>2.2.0.1</Version>
<RootNamespace>asp</RootNamespace>
<Copyright>Jurio li</Copyright>
<AssemblyName>Blazor.WebForm.Components</AssemblyName>
Expand All @@ -17,7 +17,7 @@

<ItemGroup>
<PackageReference Include="Applied" Version="1.2.1.6" />
<PackageReference Include="Blazor.WebForm.UI" Version="2.0.1.6" />
<PackageReference Include="Blazor.WebForm.UI" Version="2.2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.6" />
</ItemGroup>

Expand Down
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blazor.WebForm.Components
ASP.NET Web Forms System.Web.UI.WebControls Razor Components For Blazor WebAssembly.
ASP.NET Web Forms System.Web.UI.WebControls Razor Components For Blazor WebAssembly, Blazor Hybrid, Blazor Server.

Demo: <https://blazorwebformdemo.github.io/>

Expand Down Expand Up @@ -129,3 +129,41 @@ Demo: <https://blazorwebformdemo.github.io/>
<td>RequiredFieldValidator</td><td></td>
</tr>
</table>




### Blazor Server

Add CircuitHandler service to Program.cs

<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: &quot;Source Code Pro&quot;, Consolas, Courier, monospace; font-size: 15px; line-height: 22px; margin-bottom: 22px; margin-top: 22px; max-width: 100%; overflow: auto; padding: 4.5px 11px;"><code class="language-cs hljs" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: none; display: block; font-family: &quot;Source Code Pro&quot;, Consolas, Courier, monospace; font-size: 1em; line-height: inherit; margin: 0px; overflow-x: auto; padding: 0px; text-size-adjust: none;">builder.Services.AddScoped&lt;CircuitHandler, ScriptManagerCircuitHandler&gt;();</code></pre>


<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: &quot;Source Code Pro&quot;, Consolas, Courier, monospace; font-size: 15px; line-height: 22px; margin-bottom: 22px; margin-top: 22px; max-width: 100%; overflow: auto; padding: 4.5px 11px;"><code class="language-cs hljs" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: none; display: block; font-family: &quot;Source Code Pro&quot;, Consolas, Courier, monospace; font-size: 1em; line-height: inherit; margin: 0px; overflow-x: auto; padding: 0px; text-size-adjust: none;">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);
}
}
}</code></pre>

0 comments on commit 8e14978

Please sign in to comment.