topical media & game development

talk show tell print

professional-xml-01-Listing-1-3.xml / xml



  <?xml version="1.0" encoding="UTF-8" ?>
  <Value>
     <![CDATA[
     <script runat="server">
      protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
      {
          string[] CarArray = new string[4] {"Ford", "Honda", "BMW", "Dodge"};
          string[] AirplaneArray = new string[3] {"Boeing 777", "Boeing 747", 
             "Boeing 737"};
          string[] TrainArray = new string[3] {"Bullet Train", "Amtrack", "Tram"};
          
          if (DropDownList1.SelectedValue == "Car") {
              DropDownList2.DataSource = CarArray; }
          else if (DropDownList1.SelectedValue == "Airplane") {
              DropDownList2.DataSource = AirplaneArray; }
          else {
              DropDownList2.DataSource = TrainArray; 
          }
                  
          DropDownList2.DataBind();
          DropDownList2.Visible = true;
      }
  
      protected void Button1_Click(object sender, EventArgs e)
      {
          Response.Write("You selected <b>" +
             DropDownList1.SelectedValue.ToString() + ": " +
             DropDownList2.SelectedValue.ToString() + "</b>");
      }
     </script>
     ]]>
  </Value>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.