by using the code below you can bind your enums to your dropdown lists
Serkan Şendur
by using the code below you can bind your enums to your dropdown lists
Serkan Şendur
public static DataTable ConvertEnumToDataTable(Enum parEnumToConvert)
{
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Name");
int i = 0;
foreach (string s in Enum.GetNames(typeof(yourCustomEnum)))
{
DataRow dr = dt.NewRow();
dr["ID"] = i;
dr["Name"] = s;
dt.Rows.Add(dr);
i++;
}
return dt;
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.