title: ASP.NET C# change selected value from drop down list output to label
body: <p>Ok so the problem i am having is with a drop down list.
  the drop down list is supposed to output (Drinklabel) the selected value, it dose this but only the first in the list (the drop down list is generated by session variable).</p>
  
  <p>I would like it so i could use the drop down list, select new value then have the label (Drinklabel) update itself.</p>
  
  <p>*<em>code bellow *</em></p>
  
  <pre><code> protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
      {
          Drinklabel.Text = "Your Chosen Beverage is A " + DropDownList1.SelectedValue.ToString() + " Drink.";
      }
  </code></pre>
  
  <p>////////////////////////////////////////////////////////////</p>
  
  <p>Full about page code</p>
  
  <pre><code>public partial class About : Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
  
  
          MyFruit = Session["Fruitname"] as List&lt;string&gt;;
          //Create new, if null
          if (MyFruit == null)
              MyFruit = new List&lt;string&gt;();
          DropDownList1.DataSource = MyFruit;
          DropDownList1.DataBind();
  
      }
  
      public List&lt;string&gt; MyFruit { get; set; }
  
      protected void ButtonCalculate_Click(object sender, EventArgs e)
      {
          decimal total = calculatePrice(DropDownList1.SelectedItem.Text,
                                         TextBoxQuantity.Text.Trim());
  
          LabelResult.Text = "You would like " + TextBoxQuantity.Text.Trim() +
              DropDownList1.SelectedItem.Text + "(s) for a total of $" +
              total.ToString();
      }
  
      private decimal calculatePrice(string p1, string p2)
      {
          throw new NotImplementedException();
      }
  
      private decimal calculatePrice(string fruitName, int quantity)
      {
          // Ask the database for the price of this particular piece of fruit by name
          decimal costEach = GoToDatabaseAndGetPriceOfFruitByName(fruitName);
  
          return costEach * quantity;
      }
  
      private decimal GoToDatabaseAndGetPriceOfFruitByName(string fruitName)
      {
          throw new NotImplementedException();
      }
  
  
  }
  </code></pre>