title: Add a drop down list to a GridView cell
body: <p>I want to make a column in the GridView a drop down list so the user can select an option from this list. </p>
  
  <p>GridView code:</p>
  
  <pre><code>&lt;asp:GridView  style="float:left"  
        ID="gvBookings" 
        ShowHeaderWhenEmpty="true"
        CssClass="tblResults" 
        runat="server" 
        OnRowDataBound="gvBooking_RowDataBound"                             
        DataKeyField="ID" 
        AutoGenerateColumns="false"
        allowpaging="false" /&gt;
          &lt;Columns&gt;       
               &lt;asp:BoundField DataField="FinishTime" HeaderText="Finish Time"&gt;&lt;/asp:BoundField&gt;
               &lt;asp:BoundField DataField="TimeSpentName" HeaderText="Time Spent By"&gt;&lt;/asp:BoundField&gt;
           &lt;/Columns&gt;
       &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Code Behind:</p>
  
  <pre><code>protected void gvBooking_RowDataBound(object sender, GridViewRowEventArgs e)
   {
        BHTaskClass.BookingTask booking = (BHTaskClass.BookingTask)e.Row.DataItem;
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
              int count = 1;
              foreach (TableCell c in e.Row.Cells)
              {
                 if (count == 1)
                 {
                      string FinishTime = booking.FinishTime.HasValue ? booking.FinishTime.Value.ToString("hh':'mm") : "";
                      c.Text = "&lt;input type=\"text\" id=\"txtFinishTime" + booking.ID + "\" style=\"width:70px\" type=\"text\" onblur=\"UpdateFinishTime(" + booking.ID + ",this.value)\"   value=\"" + FinishTime + "\" &gt;";
                 }
                  count++;
              }
        }
   }
  </code></pre>
  
  <p>In the code behind I changed the cell for <code>FinishTime</code> to a textbox. And when the user enters a value in here it calls a function that updates the database. 
  How do I change the cell to become a drop down menu? Can I do it did in the code behind like I created the textbox or would it be better to change the <code>Boundfield</code> in the GridView</p>