title: Using the selected value of a dropdown list in an if statement
body: <p>I'm trying to select the value from this drop down list to use in an if statement so that I can then do calculations based on which choice is chosen. I'm not sure if this is the right way to do it, any help would be much appreciated!</p>
  
  <pre><code>   &lt;asp:DropDownList ID="ddlHours" runat="server"&gt;
                  &lt;asp:ListItem &gt;Select&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem &gt;Part-Time&lt;/asp:ListItem&gt;
                  &lt;asp:ListItem &gt;Full-Time&lt;/asp:ListItem&gt;
              &lt;/asp:DropDownList&gt;
  
  const int PART_TIME = 15;
                  const int FULL_TIME = 25;
                  double fee = 0;
  
                  if (ddlHours.SelectedItem.Value == "Part-Time")
                  {
                      CalculatePartTime(PART_TIME, fee);
  
                  }
  
                  else if (ddlHours.SelectedItem.Value == "Full-Time")
                  {
                      CalculateFullTime(FULL_TIME, fee);
                  }
  
                  lblAnswer.Text = String.Format("{0}",fee);
  </code></pre>