Вы должны написать пользовательский TypeConverter
для выполнения этой обязанности.
public class MyItemsConverter : TypeConverter
{
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
StringCollection values = new StringCollection();
// Connect to database and read values.
return new StandardValuesCollection(values);
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return (context != null);
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
}
public class MyControl : WebControl
{
[TypeConverter(typeof(MyItemsConverter))]
public string MyItem { get; set; }
}