To bind the enumerations to the GridView, you can use following code snippets.
You need to use following namespaces
using System.Collections;
using System.Collections.Generic;
GridViewPoints.DataSource = ToList(typeof(MyDepartment));
GridViewPoints.DataBind();
Here
MyDepartment is the name of my enumeraitons.
// call this method as DataSource
private ArrayList ToList(Type type)
{
ArrayList list = new ArrayList();
Array enumValues = Enum.GetValues(type);
int i = 1;
foreach (Enum value in enumValues)
{
list.Add(i + ". " + value.ToString());
i++;
}
return list;
}
Hope this will help somebody.
Thanks