title: Gridview Calendar Extender get date
body: <p>I have a GridView which allows users to enter data using a EmptyDataTemplate. There is a text box having a calendarextender. I want to get the date entered (format MM/dd/yyyy) and pass it to the database. </p>
  
  <p>Please let me know how to do it.</p>
  
  <p>My code:</p>
  
  <pre><code>&lt;asp:GridView ID="GV_Rotl_Asgt" runat="server" EnableModelValidation="True" 
                 BackColor="White" BorderColor="#999999" BorderStyle="None"
                              BorderWidth="1px" CellPadding="3" Font-Names="Arial" 
                    Font-Size="8pt" GridLines="Vertical"                                
                              AllowSorting="True" EnableSortingAndPagingCallbacks="True" AutoGenerateColumns="False"
                             Width="1196px"                                                              
                             ShowFooter="True" OnRowCommand="GV_RowCommand" DataKeyNames="Emplid"&gt;
  
               &lt;FooterStyle BackColor="#CCCCCCC" ForeColor="Black" /&gt;
               &lt;PagerSettings PageButtonCount="1000" /&gt;
               &lt;RowStyle BackColor="#EEEEEE" ForeColor="Black" /&gt;
               &lt;Columns&gt; 
                      &lt;asp:TemplateField HeaderText="Action" HeaderStyle-ForeColor="#00349C"&gt; 
                         &lt;ItemTemplate&gt;
                           &lt;asp:LinkButton ID="btnEdit" Text="Edit" runat="server" CommandName="Edit" CssClass="infotitle" /&gt; &lt;br /&gt; 
                           &lt;asp:LinkButton ID="btnDelete" Text="Delete" runat="server" CommandName="Delete"  CssClass="infotitle"/&gt; 
                         &lt;/ItemTemplate&gt;
                         &lt;EditItemTemplate&gt; 
                           &lt;asp:LinkButton ID="btnUpdate" Text="Update" runat="server" CommandName="Update"  CssClass="infotitle" /&gt;
                           &lt;asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel"  CssClass="infotitle"/&gt;
                         &lt;/EditItemTemplate&gt;
                         &lt;FooterTemplate&gt;
                           &lt;asp:LinkButton runat="server" ID="Insert" Text="Insert" CommandName="InsertNew" CssClass="infotitle" /&gt;
                           &lt;asp:LinkButton runat="server" ID="Cancel" Text="Cancel" CommandName="CancelNew" CssClass="infotitle" /&gt;
                         &lt;/FooterTemplate&gt;
                      &lt;/asp:TemplateField&gt; 
                   &lt;/Columns&gt;
                   &lt;EmptyDataTemplate&gt;
                   &lt;table id="NoDatatbl" width="100%" style="margin-right: 0px"&gt;
                      &lt;tr&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                               To Date&lt;/td&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                               From Date&lt;/td&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                               Rotational Assignment&lt;/td&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                               Location&lt;/td&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
  
                         &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;/table&gt;
                      &lt;table id="NoDatatbl1" width="100%" style="margin-right: 0px"&gt;
                      &lt;tr&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                             &lt;asp:TextBox runat="server" ID="NodataToDt" format="MM/dd/yyyy"/&gt; 
                            &lt;asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="NodataToDt" format="MM/dd/yyyy"/&gt;
                           &lt;/td&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                              &lt;asp:TextBox runat="server" ID="NodatafrmDt" format="MM/dd/yyyy"/&gt;
                              &lt;asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="NodatafrmDt" format="MM/dd/yyyy"/&gt;
  
                              &lt;asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="NodatafrmDt" ControlToCompare="NodataToDt" Operator="GreaterThanEqual"
                                Display="Dynamic" ErrorMessage="From Date should be greater than To Date" 
                               Type="Date"&gt;&lt;/asp:CompareValidator&gt;
                            &lt;asp:ValidatorCalloutExtender ID="CompareValidator1_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="CompareValidator1"&gt;
                              &lt;/asp:ValidatorCalloutExtender&gt;
  
  
                               &lt;/td&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                                &lt;asp:TextBox runat="server" ID="NodataRotl" /&gt;&lt;/td&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                                &lt;asp:TextBox runat="server" ID="NodataLoc" /&gt;&lt;/td&gt;
                        &lt;td class="ColumnHead" width="150px"&gt;
                         &lt;asp:LinkButton runat="server" ID="LinkButton1" Text="Insert" CommandName="NoDataInsert" CssClass="infotitle" /&gt;
                         &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;/table&gt;
                   &lt;/EmptyDataTemplate&gt;
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Basically, I want to fetch the values from the NodataToDt &amp; NodatafrmDt textboxes in codebehind and pass the values to my stored procedure.</p>
  
  <p>Thanks</p>