title: DropDownList error in ASP.NET
body: <p>this is my drpdownlist </p>
  
  <pre><code>&lt;asp:DropDownList ID="DriverGender" runat="server"&gt;
                           &lt;asp:ListItem Text="M" Value="M"&gt;&lt;/asp:ListItem&gt;
                           &lt;asp:ListItem Text="F" Value="F"&gt;&lt;/asp:ListItem&gt;
                          &lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>And from the code behind i would like to select a value from the dropdown depending on the value stored in the database. 
  Code:</p>
  
  <pre><code>DriverGender.Items.FindByValue((String)DataReaderObj["gender"]).Selected = true; 
  </code></pre>
  
  <p>But this is the recurring error i get :
  Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.</p>