Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Nick Thissen
on
You can select a dropdown item via a simple script. Keep in mind that this will also trigger the actions under that dropdown item.

Replace "Dropdown1" with the name of your dropdown, and "Item text" with the text of the item you want to select.
using System;
using System.Linq;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;

namespace Scripts
{
public class SelectDropdownItemTest : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
Dropdown dropdown = item.Theme.Dropdowns.Find("Dropdown1");
DropdownItem ddItem = dropdown.Items.FirstOrDefault(i => i.Text == "Item text");

if (ddItem != null)
dropdown.SelectedItem = ddItem;

return null;
}
}
}