title: ASP:NET Binding dropdownlist inside of the repeater
body: <p>What i want to do is binding and dropdown list inside of the repeater but I didn't make it. I'am getting following error at the marked line: System.NullReferenceException. Any help would be appriciated.</p>
  
  <p>Back-end:</p>
  
  <pre><code>    protected void shoeRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
      {
          FixbayDBDataContext db = new FixbayDBDataContext();
          var colors = from c in db.ColorTbls select new { ColorID = c.ColorID, ColorName = c.ColorName, };
  
          DropDownList ddl = (DropDownList)e.Item.FindControl("colorList1");
          ddl.DataSource = colors; //ERROR LINE
          ddl.DataTextField = "ColorName";
          ddl.DataValueField = "ColorName";
      }
  </code></pre>
  
  <p>Front-End:</p>
  
  <pre><code>&lt;ajaxToolkit:TabPanel ID="TabPanel5" runat="server"&gt;
                  &lt;HeaderTemplate&gt;Show Shoes&lt;/HeaderTemplate&gt;
                  &lt;ContentTemplate runat="server"&gt;                                                               
                      &lt;asp:Repeater ID="shoeRepeater" OnItemCreated="shoeRepeater_ItemDataBound" runat="server"&gt;
                          &lt;HeaderTemplate&gt;&lt;/HeaderTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;table border="1" style="border-color:#ff9900; width:400px; font-weight:bold; font-family:'Oswald', Arial, sans-serif;"&gt;
                                  &lt;tr&gt;
                                      &lt;td rowspan="6" style="width:150px; height:150px;"&gt;
                                          &lt;image src="shoeImages/&lt;%#DataBinder.Eval(Container.DataItem,"ImagePath") %&gt;"&gt;&lt;/image&gt;
                                      &lt;/td&gt;
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;
                                          &lt;%#DataBinder.Eval(Container.DataItem,"BrandName") %&gt; &lt;%#DataBinder.Eval(Container.DataItem,"ModelName") %&gt; 
                                      &lt;/td&gt;
  
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;
                                          Price: $&lt;%#DataBinder.Eval(Container.DataItem,"Price") %&gt;
                                      &lt;/td&gt;
  
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;
                                          Size: &lt;%#DataBinder.Eval(Container.DataItem,"Size") %&gt;
                                      &lt;/td&gt;
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;
                                          &lt;asp:DropDownList ID="colorList1" onchange="get(this)" runat="server"&gt;
                                          &lt;/asp:DropDownList&gt;
                                          Color: &lt;%#DataBinder.Eval(Container.DataItem,"PrimaryColor") %&gt; - &lt;%#DataBinder.Eval(Container.DataItem,"SecondaryColor") %&gt;
                                      &lt;/td&gt;
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;
                                          Quantity: &lt;%#DataBinder.Eval(Container.DataItem,"Quantity") %&gt;
                                      &lt;/td&gt;
  
                                  &lt;/tr&gt;
                              &lt;/table&gt;
                          &lt;/ItemTemplate&gt;
                          &lt;FooterTemplate&gt;&lt;/FooterTemplate&gt;
                      &lt;/asp:Repeater&gt;
                  &lt;/ContentTemplate&gt;
              &lt;/ajaxToolkit:TabPanel&gt;
  </code></pre>