title: Loop through Item Template and save changes to database
body: <p>Hoping someone can help. </p>
  
  <p>We have a webpage we are pulling data from a database into bootstrap items and a drop down. The front end user is able to change the value in the dropdown. </p>
  
  <p>However in the c# we are unsure how to take the changed drop down values, iterate through the item template and update the appropriate database table. </p>
  
  <p>The code so far is: </p>
  
  
  
  <pre><code>                &lt;asp:SqlDataSource ID="getBacklog" runat="server" ConnectionString="&lt;%$ ConnectionStrings:smsConnection %&gt;"
                      SelectCommand="SELECT projbacklog.Id, projbacklog.projectId, projbacklog.projectname, projbacklog.priority, projbacklog.refnum, projbacklog.userstory
                  FROM projbacklog
                  INNER JOIN projects ON projbacklog.projectId = projects.Id
                  WHERE projbacklog.projectId = 9 ORDER BY projbacklog.priority ASC"&gt;&lt;/asp:SqlDataSource&gt;
  
                  &lt;!-- SQL data source to pull dropdown menu for priority level --&gt;
  
                  &lt;asp:SqlDataSource ID="priorityDropdown" runat="server" ConnectionString="&lt;%$ ConnectionStrings:smsConnection %&gt;"
                      SelectCommand="SELECT * FROM projbacklog WHERE projbacklog.projectId = 9"&gt;&lt;/asp:SqlDataSource&gt;
  
                  &lt;asp:Label ID="projectNameLbl" runat="server" Text='&lt;%# Eval("projectname") %&gt;'&gt;&lt;/asp:Label&gt;
  
                  &lt;asp:ListView ID="backlog" runat="server" DataSourceID="getBacklog"&gt;
  
                      &lt;ItemTemplate&gt;
  
                          &lt;br /&gt;
                          &lt;ul class="list-group"&gt;
                              &lt;li class="list-group-item"&gt;
  
                                  &lt;asp:Label ID="userStoryTxt" runat="server" Text='&lt;%# Eval("userstory") %&gt;'&gt;&lt;/asp:Label&gt;&amp;nbsp;
                                   &lt;asp:Label ID="refNum" runat="server" Text='&lt;%# Eval("refnum") %&gt;'&gt;&lt;/asp:Label&gt;&amp;nbsp;
                                  &lt;asp:DropDownList ID="storyPriorityDrp" runat="server" DataSourceID="priorityDropdown" SelectedValue='&lt;%# Bind("priority") %&gt;' DataTextField="priority" DataValueField="priority"&gt;
                                  &lt;/asp:DropDownList&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/ItemTemplate&gt;
  </code></pre>
  
  <p>On the click of the button we want to save the new value back to the database. Hope you can help :) </p>