Skip to content

Commit a169024

Browse files
committed
2.0.0.8
1 parent a5a514a commit a169024

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

-90 KB
Binary file not shown.
90.1 KB
Binary file not shown.

Blazor.WebForm.Components/Base/ListControlComponent.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ namespace Blazor.WebForm.UI.ControlComponents
1212
public abstract class ListControlComponent<TControl> : DataBoundControlComponent<TControl>
1313
where TControl : ListControl, new()
1414
{
15+
private bool _hasBindSelectedValue;
16+
1517
[Parameter]
1618
public string ValidationGroup
1719
{
@@ -34,7 +36,14 @@ public virtual string SelectedValue
3436
}
3537
set
3638
{
37-
this.Control.SelectedValue = value;
39+
if (_hasBindSelectedValue)
40+
{
41+
((IBindingListControl)this.Control).SelectedValue = value;
42+
}
43+
else
44+
{
45+
this.Control.SelectedValue = value;
46+
}
3847
}
3948
}
4049

@@ -192,8 +201,10 @@ protected override void OnInitialized()
192201
base.OnInitialized();
193202
if (this.HasPropertyBindEvent<string>(nameof(this.SelectedValue)))
194203
{
204+
_hasBindSelectedValue = true;
195205
this.Control.AutoPostBack = true;
196206
this.Control.SelectedIndexChanged += this.BindSelectedIndexChanged;
207+
((IBindingListControl)this.Control).DataBindingSelectedIndexChanged += this.BindSelectedIndexChanged;
197208
if (this.HasEventProperty(nameof(this.OnSelectedIndexChanged)))
198209
{
199210
this.SetBindEventProperty(nameof(this.OnSelectedIndexChanged), this.BindSelectedIndexChanged);

Blazor.WebForm.Components/Blazor.WebForm.Components.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<SignAssembly>true</SignAssembly>
66
<AssemblyOriginatorKeyFile>Blazor.WebForm.Components.pfx</AssemblyOriginatorKeyFile>
7-
<Version>2.0.0.7</Version>
7+
<Version>2.0.0.8</Version>
88
<RootNamespace>asp</RootNamespace>
99
<Copyright>Jurio li</Copyright>
1010
<AssemblyName>Blazor.WebForm.Components</AssemblyName>
@@ -17,7 +17,7 @@
1717

1818
<ItemGroup>
1919
<PackageReference Include="Applied" Version="1.2.1.6" />
20-
<PackageReference Include="Blazor.WebForm.UI" Version="2.0.0.7" />
20+
<PackageReference Include="Blazor.WebForm.UI" Version="2.0.0.8" />
2121
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.1" />
2222
</ItemGroup>
2323

0 commit comments

Comments
 (0)