title: error when selected value from DDL
body: <p>I had <code>datalist</code> and I had <code>ddl</code> on it and user can select value from <code>ddl</code> to bind <code>datalist</code>. When I tried to find <code>ddl</code> in <code>datalist</code> when user select value, this error apeared </p>
  
  <blockquote>
    <p>Index was out of range. Must be
    non-negative and less than the size of
    the collection. Parameter name: index</p>
  </blockquote>
  
  <p>here </p>
  
  <pre><code>DDLProduct2 = (DropDownList)DLProduct.Items[DLProduct.EditItemIndex].FindControl("DDlProduct");
  </code></pre>
  
  <p>so please any one help me.</p>
  
  <pre><code>private DropDownList DDLProduct2;
  
      protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              ProductByProductID();
              CategoryParentZero();
  
  
          }
      }
   protected void DDlProduct_SelectedIndexChanged(object sender, EventArgs e)
      {
          DDLProduct2 = (DropDownList)DLProduct.Items[DLProduct.EditItemIndex].FindControl("DDlProduct");
          if (DDLProduct2 != null)
          {
              if (DDLProduct2.SelectedIndex &gt; 0)
              {
                  using
                  (SqlConnection conn = Connection.GetConnection())
                  {
                      SqlCommand cmd = new SqlCommand();
                      cmd.Connection = conn;
                      cmd.CommandType = CommandType.StoredProcedure;
                      cmd.CommandText = "SP_GetProductsByProductID";
                      SqlParameter ParentID_Param = cmd.Parameters.Add("@ProductID", SqlDbType.Int);
                      ParentID_Param.Value = DDLProduct2.SelectedValue;
                      ;
                      DataTable dt = new DataTable();
                      SqlDataAdapter da = new SqlDataAdapter();
                      da.SelectCommand = cmd;
                      da.Fill(dt);
                      DLProduct.DataSource = dt;
                      DLProduct.DataBind();
  
                  }
              }
          }
  
      } 
  </code></pre>