How to get access the selected value in a drop down list using C#
<p>I am trying to access the selected value in a drop down list and pass that value in my select statement so I can only pull a filtered data but I am getting an error and the chart is not generated as a result of this issue.   Here is the error: “Error: 'pieYScale' is null or not an object”.<br>
 I am suspecting the way I am referencing the selected value in the drop down list is wrong.  </p>

<pre><code>public string CreateChart()
    {
        string DDList = DropDownList1.SelectedValue;

        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
        string sqlStatement = "select   Status as GroupCategory, Count(Status) as TotalCount from  [MasterProject] where Closing_Date &gt;=  '" + txtStartClosingDate.Text + "' and Closing_Date &lt;= '" + txtEndClosingDate.Text + "' and GroupProject = '" + DDList + "' and Status is not null group by  Status Order by TotalCount Desc";

        SqlCommand cmd = new SqlCommand(sqlStatement, con);
        con.Open();
        SqlDataReader reader = cmd.ExecuteReader();
        string strXML;
        strXML = "&lt;graph decimalPrecision='0' name='MyXScaleAnim' type='ANIMATION' duration='1' start='0' param='_xscale' showNames='1' labelDisplay='Rotate' useEllipsesWhenOverflow='1'  pieSliceDepth='30' formatNumberScale='0'&gt;";
        while (reader.Read())
        {
            strXML += "&lt;set name='" + reader["GroupCategory"].ToString() + "' value='" + reader["TotalCount"].ToString() + "' /&gt;";
        }
        strXML += "&lt;/graph&gt;";
        return FusionCharts.RenderChart("../FusionCharts/Column3D.swf", "ChartID", strXML, "FactorySum", "500", "350", false, false);

    }
</code></pre>
