title: dropdownlist selectedindex not changing c#
body: <p>I have a simple problem. I research on the internet but I could not find clear solution. I have a dropdownlist in may page and I want to display or hide something depends on its selected index changing. I have this code and I am sure this code should work because I wrote many times like this:</p>
  
  <pre><code>&lt;div class="icerik-tablo"&gt;
              &lt;div&gt;
                  &lt;h3&gt;Telefon Bilgileri&lt;/h3&gt;
                  &lt;div class="ekle"&gt;&lt;a href="javascript:;" onclick="ekle_goster('ekle_telefon')"&gt;Ekle&lt;/a&gt;&lt;/div&gt;
                  &lt;div class="clear"&gt;&lt;/div&gt;
  
                  &lt;div class="pop" id="ekle_telefon" style="display:none;"&gt;
                  &lt;asp:UpdatePanel ID="upTelefon" runat="server"&gt;
                      &lt;ContentTemplate&gt;                        
                              &lt;div&gt;
                                  &lt;asp:DropDownList ID="ddlTelefonTipi" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlTelefonTipi_SelectedIndexChanged"&gt;&lt;/asp:DropDownList&gt;
                                  &lt;asp:RequiredFieldValidator ID="rfvTelefonTipi" runat="server" ControlToValidate="ddlTelefonTipi" ErrorMessage="*" ValidationGroup="telefonEkle"&gt;&lt;/asp:RequiredFieldValidator&gt;
                                  &lt;asp:DropDownList ID="ddlTelefonErisimTipi" runat="server" AutoPostBack="true"&gt;&lt;/asp:DropDownList&gt;
                                  &lt;asp:RequiredFieldValidator ID="rfvTelefonErisimTipi" runat="server" ControlToValidate="ddlTelefonErisimTipi" ErrorMessage="*" ValidationGroup="telefonEkle"&gt;&lt;/asp:RequiredFieldValidator&gt;
                                  &lt;asp:CheckBox ID="cbTelefonBirincil" runat="server" Text="Birincil Yap" /&gt;
                              &lt;/div&gt;
                              &lt;br /&gt;&lt;br /&gt;
                              &lt;div class="islem"&gt;
                                  &lt;asp:Button ID="btnTelefonEkle" runat="server" Text="Ekle" /&gt;
                                  &lt;a href="javascript:;" onclick="ekle_gizle('ekle_telefon')"&gt;İptal&lt;/a&gt;
                              &lt;/div&gt;
                              &lt;div class="clear"&gt;&lt;/div&gt;                        
                      &lt;/ContentTemplate&gt;
                  &lt;/asp:UpdatePanel&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>These are my page codes. And the C# codes are here: </p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              TelefonTipiBagla();
              TelefonErisimTipiBagla();
          }
      }
  
      protected void TelefonTipiBagla()
      {
          ddlTelefonTipi.DataSource = Telefon.StringTelefonTipi;
          ddlTelefonTipi.DataBind();
          ddlTelefonTipi.Items[0].Value = "";
      }
  
      protected void TelefonErisimTipiBagla() 
      {
          ddlTelefonErisimTipi.DataSource = IletisimBaseClass.StringIzinTipi;
          ddlTelefonErisimTipi.DataBind();
          ddlTelefonErisimTipi.Items[0].Value = "";
      }
  
  
      protected void ddlTelefonTipi_SelectedIndexChanged(object sender, EventArgs e)
      {
  
          if ((Telefon.TelefonTipi)ddlTelefonErisimTipi.SelectedIndex == Telefon.TelefonTipi.CepTelefonu || (Telefon.TelefonTipi)ddlTelefonErisimTipi.SelectedIndex == Telefon.TelefonTipi.Faks)
          {
              string val = ddlTelefonErisimTipi.SelectedValue;
              tbTelefonDahili.Visible = false;
              lblTelefonTire.Visible = false;
              lblTelefonDahili.Visible = false;
          }
          else
          {
              string val = ddlTelefonErisimTipi.SelectedValue;
              tbTelefonDahili.Visible = true;
              lblTelefonTire.Visible = true;
              lblTelefonDahili.Visible = true;
          }
      }
  </code></pre>
  
  <p>The problem is dropdownlist selected index always come zero(0). So , my code didn't work correctly. Please help me I'm sure I'm missing something. Thanks for your helps.</p>