Hi I have a calendar extender in the edititemtemplate section of a gridview. I need to set the start date to the current day. I did this on another page by writing

 CalendarExtender1.StartDate = DateTime.Today;

However as the extender is in a gridview it isn't appearing in the back end code. Any ideas how I can fix this. The code for the gridview is.

 <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
                DataSourceID="SqlDataSource1" BorderColor="#333333"
        Font-Size="Medium" ForeColor="#FFCCCC" HorizontalAlign="Center"
        CellPadding="2" CellSpacing="2" 
        EmptyDataText="You have no upcoming appointments." >
        <AlternatingRowStyle Font-Bold="false" ForeColor="#FF99CC" />
                <Columns>    
                      <asp:TemplateField HeaderText="Date" SortExpression="Period">
                          <EditItemTemplate>
                              <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Period", "{0:d}") %>'></asp:TextBox>
                              <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" Format="dd/MM/yyyy">
                              </ajaxToolkit:CalendarExtender>
                          </EditItemTemplate>
                          <ItemTemplate>
                              <asp:Label ID="Label3" runat="server" Text='<%# Bind("Period", "{0:d}") %>'></asp:Label>
                          </ItemTemplate>
                      </asp:TemplateField>
                    <asp:TemplateField HeaderText="Time" SortExpression="Time">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList1" runat="server" 
                                DataSourceID="SqlDataSource2" DataTextField="Time" DataValueField="Time" 
                                SelectedValue='<%# Bind("Time") %>'>
                            </asp:DropDownList>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Time") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Treatment" SortExpression="Treatment">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList2" runat="server" 
                                DataSourceID="SqlDataSource3" DataTextField="Treatment" 
                                DataValueField="Treatment" SelectedValue='<%# Bind("Treatment") %>'>
                            </asp:DropDownList>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("Treatment") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                   <asp:TemplateField HeaderText="Stylist" SortExpression="Stylist">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList4" runat="server" 
                                DataSourceID="SqlDataSource4" DataTextField="EmployeeName" 
                                DataValueField="EmployeeName" SelectedValue='<%# Bind("Stylist") %>'>
                            </asp:DropDownList>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("Stylist") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                      <asp:BoundField DataField="ID" HeaderText="ID" 
                        SortExpression="ID" ReadOnly="True" InsertVisible="False" Visible="False"/>
                    <asp:BoundField DataField="ClientName" HeaderText="ClientName" 
                        SortExpression="ClientName" ReadOnly="false"/>
                    <asp:BoundField DataField="Username" HeaderText="Username" 
                        SortExpression="Username" ReadOnly="false"/>
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                        ButtonType="Button" />
                </Columns>

            </asp:GridView>

Thank you in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.