title: Building dynamic DropDownList with Event Handling
body: <p>I want to build a dynamic <code>DropDownList</code> and add some list item. 
  With below code I can do it.</p>
  
  <pre><code>protected void BuildDynamicDropDown()
  {
      DropDownList ddl = new DropDownList();
      ddl.ID = "newDDL";
      ddl.SelectedIndexChanged += dynamicDDL_SelectedIndexChanged;
      ddl.Items.Add(new ListItem("stack1", "stack1"));
      ddl.Items.Add(new ListItem("stack2", "stack2"));
      ddl.Items.Add(new ListItem("stack3", "stack3"));
      ddl.AutoPostBack = true;
      Panel1.Controls.Add(ddl);
  }
  
  protected void dynamicDDL_SelectedIndexChanged(object sender, EventArgs e)
  {
      //this part of code should trig another dynamic dropdown
  }
  </code></pre>
  
  <p>But <strong>I want to use that SelectedIndexChanged event in order to change another dynamic dropdown value</strong>.</p>
  
  <p>Do you have any idea?    </p>
  
  <p>At this link <a href="https://stackoverflow.com/questions/3649357/how-to-create-event-handler-for-dynamic-drop-down-list-in-c-sharp">how to create event handler for  dynamic drop down list in c#</a> 
  one solution likes below</p>
  
  <pre><code>ddlFilter.SelectedIndexChanged += new EventHandler(ddl2_SelectedIndexChanged);
  ddlFilter.AutoPostBack = true;
  
  void ddlFilter_SelectedIndexChanged(object sender, EventArgs e)
  {
      //your code 
  }
  </code></pre>
  
  <p>Shortly,
  I want to build more than one dynamic dropdown and assume that 3 dropdown and I want to handle their <code>selectedindexchange</code> events in order to interact between themselves.</p>