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

Action Dropdown from button

1 Answer 199 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 01 Oct 2020, 12:12 PM

I'm trying to create a dropdownlist like in the attached image. The button launches the dropdown and each dropdown item is an action that launches a javascript function. Is this possible with .Net Core?

 

 

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 06 Oct 2020, 08:03 AM

Hi Andrew,

A possible approach is to use the Toolbar widget. For each item, you could set the overflow option to 'always'. You could use template and overflowTemplate in order to configure the DropDownLists. Below is an example of the syntax in UI for ASP.NET Core:

items.Add()
  .Template("<input id='dropdown' style='width: 150px;' />")
  .OverflowTemplate("<input id='dropdown' style='width: 150px;' />")
  .Overflow(ShowInOverflowPopup.Always);

When an item in the DropDownList is selected, in the select event handler, you could find the selected item and execute the needed function.

.Events(e => e .Select("onSelect"))

 

function onSelect(e) {
      var selected = e.dataItem.text;
       ....
  }

Here is a Dojo example that demonstrates such implementation.  

I hope this helps. Let me know in case you have additional questions on the matter.

Regards,
Neli
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
DropDownList
Asked by
Andrew
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or