Search code examples
asp.netdrop-down-menuasp.net-charts

How can I populate a drop down box with all the possible SeriesChartType options?


I wish to populate a drop down box with each possible SeriesChartType so that my users may choose an appropriate chart type.

How can I iterate through the SeriesChartType collection (it's in the namespace System.Web.Ui.DataVisualization.Charting) and return each possible option so I can add it to the drop down box?

Thanks.


Solution

  • foreach (ChartType in Enum.GetValues(typeof(System.Web.UI.DataVisualization.Charting))
    {
        //Add an option the the dropdown menu
        // Convert.ToString(ChartType) <- Text of Item
        // Convert.ToInt32(ChartType) <- Value of Item
    }
    

    If this isn't what you're looking for, let me know.