I want to parse the ChartType from a dropdown list but I couldnt parse the value,
Is there anyway to parse it ?
using System.Web.UI.DataVisualization.Charting;
...
...
Chart2.Series[0].ChartType = Enum.Parse(typeof(SeriesChartType.Area), DropDownList1.Text);
Thx in advance!
You could populate the
DropDownList1with the enumeration.The string representation of the enumeration name would be displayed as the text in
DropDownList1.DropDownList1.Items.AddRange = Enum.GetValues(typeof(SeriesChartType));
Then you can access the items of the list.
Chart2.Series[0].ChartType = (SeriesChartType)DropDownList1.SelectedItem;