diff --git a/Blazor.WebForm.Components.2.4.1.1.nupkg b/Blazor.WebForm.Components.2.4.1.1.nupkg new file mode 100644 index 0000000..089e0c3 Binary files /dev/null and b/Blazor.WebForm.Components.2.4.1.1.nupkg differ diff --git a/Blazor.WebForm.Components.2.4.1.nupkg b/Blazor.WebForm.Components.2.4.1.nupkg deleted file mode 100644 index c4b6fc2..0000000 Binary files a/Blazor.WebForm.Components.2.4.1.nupkg and /dev/null differ diff --git a/Blazor.WebForm.Components/Blazor.WebForm.Components.csproj b/Blazor.WebForm.Components/Blazor.WebForm.Components.csproj index 79981f8..4eedf48 100644 --- a/Blazor.WebForm.Components/Blazor.WebForm.Components.csproj +++ b/Blazor.WebForm.Components/Blazor.WebForm.Components.csproj @@ -4,7 +4,7 @@ net8.0 true Blazor.WebForm.Components.pfx - 2.4.1.0 + 2.4.1.1 asp Jurio li Blazor.WebForm.Components @@ -17,8 +17,8 @@ - - + + diff --git a/Blazor.WebForm.Components/Inner/ListControl/ListItem.cs b/Blazor.WebForm.Components/Inner/ListControl/ListItem.cs index 41b9e0a..07de19c 100644 --- a/Blazor.WebForm.Components/Inner/ListControl/ListItem.cs +++ b/Blazor.WebForm.Components/Inner/ListControl/ListItem.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Web.UI; namespace asp { @@ -22,6 +23,9 @@ public class ListItem : PropertyComponent [Parameter] public string Value { get; set; } + [Parameter(CaptureUnmatchedValues = true)] + public IReadOnlyDictionary Attributes { get; set; } + [Parameter] public RenderFragment ChildContent { get; set; } @@ -29,11 +33,26 @@ protected internal override void SetInnerProperty(IReadOnlyDictionary parameters); + SetAttributes(item, this.Attributes); if (parameters.ContainsKey(nameof(this.ChildContent)) && this.ChildContent != null) { Blazor.WebForm.UI.RenderUtility.SetContentString(item, this.ChildContent); } this.Owner.Items.Add(item); } + + private static void SetAttributes(IAttributeAccessor accessor, IReadOnlyDictionary attributes) + { + if (attributes != null) + { + foreach (KeyValuePair attribute in attributes) + { + if (attribute.Value is string value) + { + accessor.SetAttribute(attribute.Key, value); + } + } + } + } } }