title: Add radio button list items programmatically in asp.net
body: <p>I have a radio button list whose items I need to add on <code>Page_Load</code></p>
  
  <p>aspx code</p>
  
  <pre><code>&lt;asp:radioButtonList ID="radio1" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal"&gt;
  &lt;/asp:radioButtonList&gt;
  </code></pre>
  
  <p>code behind</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      RadioButtonList radioList = (RadioButtonList)Page.FindControl("radio1");
      radioList.Items.Add(new ListItem("Apple", "1"));
  }
  </code></pre>
  
  <p>After the control reaches <code>radioList.Items.Add</code> </p>
  
  <p>I keep getting the <code>Object reference not set to instance of an object</code>
   error</p>
  
  <p>What am I doing wrong?</p>