title: Dynamically adding drop down lists inside gridview cells
body: <p>I have a grid view, if the database is returning null for a particular column I want to insert a drop down list that is populated from a database.</p>
  
  <p>Here is the code I have to identify the the column is null and it is working correctly.</p>
  
  <pre><code>protected void viewThemeTypeAssociationsGridView_OnRowDataBound(Object sender, GridViewRowEventArgs e)
  {
      if (e.Row.Cells[1].Text == "&amp;nbsp;")
      {
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
           //fill current rows cell with a dropdown list
       }
  }
  </code></pre>
  
  <p>Here is the gridview:</p>
  
  <pre><code>    &lt;asp:GridView ID="viewThemeTypeAssociationsGridView" runat="server" 
      AutoGenerateColumns="False" BackColor="#DEBA84" BorderColor="#DEBA84" 
      BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" 
      DataSourceID="SqlDataSource6" OnRowDataBound="viewThemeTypeAssociationsGridView_OnRowDataBound"&gt;
      &lt;Columns&gt;
          &lt;asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /&gt;
          &lt;asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" /&gt;
      &lt;/Columns&gt;
      &lt;FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /&gt;
      &lt;HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /&gt;
      &lt;PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /&gt;
      &lt;RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /&gt;
      &lt;SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /&gt;
      &lt;SortedAscendingCellStyle BackColor="#FFF1D4" /&gt;
      &lt;SortedAscendingHeaderStyle BackColor="#B95C30" /&gt;
      &lt;SortedDescendingCellStyle BackColor="#F1E5CE" /&gt;
      &lt;SortedDescendingHeaderStyle BackColor="#93451F" /&gt;
  &lt;/asp:GridView&gt;
  
  &lt;asp:SqlDataSource ID="SqlDataSource6" runat="server" 
      ConnectionString="&lt;%$ ConnectionStrings:ApplicationServices %&gt;" &gt;
      &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>Additionally, once I populate the row, how do I know which drop down list specifically is being used when there are many versions of it?</p>