How to create a dynamic pre value source for dropdown\multi-dropdown?
Hi.
I created my own PreValueSource for the drop-down list, but I want to update this data every time the user opens the page.
public class SportsPreValueSourceType : FieldPreValueSourceType
{
public SportsPreValueSourceType()
{
Id = new Guid("104def6e-75d5-4e41-bdba-8a4983fa4a8f");
Name = "Sports list";
Description = "List of the sports that depends on member";
}
public override List<PreValue> GetPreValues(Field field, Form form)
{
var helper = Umbraco.Web.Composing.Current.UmbracoHelper;
var randomValue = new Random().Next(0, 1000);
var preValue = randomValue > 500 ? ">500" : "<500";
return new List<PreValue>() { new PreValue() { Id = 0, SortOrder = 0, Value = preValue } };
}
public override List<Exception> ValidateSettings()
{
var exs = new List<Exception>();
return exs;
}
}
How to create a dynamic pre value source for dropdown\multi-dropdown?
Hi.
I created my own PreValueSource for the drop-down list, but I want to update this data every time the user opens the page.
How I can do that?
is working on a reply...