Y
YankeeImperialistDog
I have a simple function that returns a collection populated with an enum. It
is a bindable data object for reopdowns using an objectdatasource.I have
another version that takes a type for a param (type of enum) but i can not
assign a type enum as a paramater using an object datasource. Is there a
simple way to find the enum using a string?
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static BasicListCollection eNumProductTypeDDL()
{
string[] names = Enum.GetNames(typeof(ProductType));
Array values = Enum.GetValues(typeof(ProductType));
var blc = new BasicListCollection();
for (int i = 0; i < names.Length; i++)
{
var bli = new BasicList();
bli.IID = Convert.ToInt32(values.GetValue(i));
bli.SzDesc = names;
blc.Add(bli);
}
return blc;
}
is a bindable data object for reopdowns using an objectdatasource.I have
another version that takes a type for a param (type of enum) but i can not
assign a type enum as a paramater using an object datasource. Is there a
simple way to find the enum using a string?
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static BasicListCollection eNumProductTypeDDL()
{
string[] names = Enum.GetNames(typeof(ProductType));
Array values = Enum.GetValues(typeof(ProductType));
var blc = new BasicListCollection();
for (int i = 0; i < names.Length; i++)
{
var bli = new BasicList();
bli.IID = Convert.ToInt32(values.GetValue(i));
bli.SzDesc = names;
blc.Add(bli);
}
return blc;
}