title: How to show Time on DropDownList from Date on database?
body: <p>I have a date that I retrieve from database. I want to give ability to edit time on my gridview, as my date is date+time, I want to show the time on my database as my selected value on the dropdown list and a ability to choose other times from the list and save back again with date+time on the database.</p>
  
  <p>What would be the best way to do this?</p>
  
  <pre><code>            &lt;asp:TemplateField HeaderText="Start Time" SortExpression="SelectionStartDate"&gt;
  
                    &lt;EditItemTemplate&gt;
                    &lt;asp:DropDownList ID="SelectionStarttime1" runat="server"  Text='&lt;%# GetTime(Eval("SelectionStartDate", "{0:dd-MM-yyyy HH:mm:ss}")) %&gt;' Width="120px"&gt;                        
                           &lt;asp:ListItem Value="10:00:00"&gt;Midday (12:00 AM)&lt;/asp:ListItem&gt;
                           &lt;asp:ListItem Value="17:00:00"&gt;End Day(05:00 PM)&lt;/asp:ListItem&gt;
                           &lt;asp:ListItem Value="23:59:59"&gt;Midnight End&lt;/asp:ListItem&gt;
                       &lt;/asp:DropDownList&gt;  
                        &lt;/EditItemTemplate&gt;                
                   &lt;ItemTemplate&gt;              
                      &lt;asp:Label ID="lblStarttime1" runat="server" Text='&lt;%# GetTime(Eval("SelectionStartDate", "{0:dd-MM-yyyy HH:mm:ss}")) %&gt;' &gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt; 
              &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>And I have the following on my VB</p>
  
  <pre><code>Protected Function GetTime(ByVal time As String) As String
  
          Return time.Substring(11)
  
      End Function
  </code></pre>
  
  <p>Thanks in advance</p>