troubleshooting Question

Using Calendar in Detailsview for insert and update

Avatar of Simon Cripps
Simon CrippsFlag for United Kingdom of Great Britain and Northern Ireland asked on
Visual Basic Classic.NET ProgrammingASP.NET
2 Comments1 Solution2114 ViewsLast Modified:
Hi, I am trying to use a calendar in the detailsview to edit and update a field. However I am running into a couple of problems.
1) The control does not update the records when in update mode. Cade is attached below, I can't see why it does not update.
2) In insert mode as the calendar expects a value I have tried to set the default values in the SQL table to 01/01/2010 - in table definition the  "Defalt Value or Binding" is set to (((1)/(1))/(2010)) - However I am getting the error SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM, somehow my defaul value is not being used as I insert,

Can you help resolve these issues on insert/edit calendar date in Detailsview.
<asp:TemplateField HeaderText="VCStartDate" SortExpression="VCStartDate">
                <EditItemTemplate>
           <%--         <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("VCStartDate") %>'></asp:TextBox>
          --%>         <asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%# Bind("VCStartDate") %>' VisibleDate='<%# Bind("VCStartDate") %>'></asp:Calendar>
                
                </EditItemTemplate>
                <InsertItemTemplate>
<%--                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("VCStartDate") %>'></asp:TextBox>
--%>                   <asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%# Bind("VCStartDate") %>'  VisibleDate='<%# Bind("VCStartDate") %>'></asp:Calendar>
  
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("VCStartDate") %>'></asp:Label>
                </ItemTemplate>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros