Custom css classes

It seems that there is code to support custom css classes in the base class RadzenComponent:

protected string GetCssClass()
            object obj = null;
            if (this.Attributes == null || !this.Attributes.TryGetValue("class", ref obj) || String.IsNullOrEmpty(Convert.ToString(obj)))
                return this.GetComponentCssClass();
            return String.Format("{0} {1}", this.GetComponentCssClass(), obj);

However, adding a class attribute to a component component does not work as expected because the AddMultipleAttributes call (from the attribute splatting) overwrites the value of the class attribute that was set before:

__builder.AddAttribute(24, "class", base.GetCssClass());
__builder.AddMultipleAttributes(25, RuntimeHelpers.TypeCheck<IEnumerable<KeyValuePair<string, object>>>(base.Attributes));

This can easily be fixed just splatting the Attributes before the class="@GetCssClass" in the component. Can this be fixed in all the components, please?

Fixed immediately! NuGet will be published later today.

1 Like

Thank you Vladimir. I confirm it is working on v2.0.2