title: asp.net how to add items programmatically to detailsview
body: <p>I have the following code for each lookup table. So far I am doing copy/paste for each drop down list control. But I think there is a better way of doing this. I should be able to specify DataTextField, DataValueField, control names etc. Of course I will have to manually add configuration related database values on the database side like look up table, and other changes in the stored proc. But at the aspx page or .cs page, there has to be a better way then copy/paste..</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Your Ethnicity"&gt;
  &lt;EditItemTemplate&gt;
  &lt;asp:DropDownList ID="ddlEthnicity" runat="server" 
  DataSourceid="ddlDAEthnicity"
  DataTextField="Ethnicity" DataValueField="EthnicityID"
  SelectedValue='&lt;%#Bind("EthnicityID") %&gt;'
  &gt;
  &lt;/asp:DropDownList&gt;
  &lt;/EditItemTemplate&gt;
  &lt;ItemTemplate &gt;
  &lt;asp:Label Runat="server" Text='&lt;%# Bind("Ethnicity") %&gt;' 
  ID="lblEthnicity"&gt;
  &lt;/asp:Label&gt;
  &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;   
  </code></pre>
  
  <p>Please let me know...
  Thanks</p>