This is a migrated thread and some comments may be shown as answers.

Correct way to use html-attributes taghelper

1 Answer 1768 Views
Toolbar
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 08 Mar 2018, 10:32 AM

Hello,
I was struggling with the kendo-toolbar taghelper to add an html attribute to a toolbar item, but eventually figured it out.
Is this the correct way to use the html-attributes taghelper or is there a shortcut ?

<item type="CommandType.Button" text="Delete" html-attributes='new Dictionary<string, object>{ ["class"] = "float-right" }' />

Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 13 Mar 2018, 09:35 AM
Hello Marcel,

In general, the Toolbar does not work with HTML elements, but rather dynamically generates its content. Therefore, adding a class="col-sm" will not add the desired class to the Toolbar item. Instead, by using the html-attributes, the "float-right" class will be correctly set to the element, as the data is being serialized correctly.

Currently, there is no shortcut available and the attributes can be added with the specified signature:
html-attributes='new Dictionary<string, object>{ ["class"] = "float-right" }'

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Toolbar
Asked by
Marcel
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or