none
Need help understanding Ajax Control Toolkit Calendar Extender DateFormat

    Question

  • Hi all,

    I have such a simple requirement and I cannot understand what is going on as I have tried both google and bing but have yet not found any resolutions. I know you all with all your expertise and generosity can help me out here.

    I am building a .net 3.5 website using visual studio empty website template. I downloaded and added the AjaxControlToolkit for .net 3.5 which is working fine no issues there.

    Now I have a requirement where a user will add date into a formview control. Inside the formview default mode is 'Insert' and 'EditItemTemplate' houses the following code:

    <asp:TextBox ID="ValidFrom" runat="server" Text='<%#Bind("ValidityDate", "{0: dd/MM/yyyy}")%' />
    <ajax:CalendarExtendar ID="CalendarCtrl" runat="server" TargetControlID="ValidFrom" Format="dd/MM/yyyy" />

    The formview control works in conjunction with SQLDataSource control which specifies insertcommand (stored procedure). The stored procedure captures ValidityDate column as SQL DateTime type and the column has Datetime data type in table design section as well.

    When I select date e.g. 01/12/2013
    selects in the right format - saves in the MM/dd/YYYY format (don't know why...???)
    binds back to formview as 12/01/2013 (so 1st dec 2013 is binds back as 12th jan 2013)

    Can please anyone, tell me what am I doing wrong - why is the date format becoming a nuisance here?

    I have the following as well:

    <%@ Page Title="Home" UICulture="auto" Culture="auto" Language="C#" AutoEventWireup="true" />

    and

    <ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true"></ajax:ToolkitScriptManager>

    Despite the above I still can't understand what is asp.net doing or ajax control toolkit doing that is causing problems with date formats. 

    Could you please throw some light on this. 

    Thank you

     


    .Net Frenzy


    Wednesday, December 04, 2013 8:03 PM

All replies

  • For help in asp.net, visit forums.asp.net.


    Visual C++ MVP

    Wednesday, December 04, 2013 9:52 PM
  • Hi .Net Frenzy,

    Since the issue regards ASP.NET and website deployment. I suggestion you post the question in the ASP.NET forums at http://forums.asp.net/. It is appropriate and more experts will assist you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, December 05, 2013 5:52 AM
  • Hi Eason_H,

    Thank you, sorry for posting to the wrong forum, a lot has changed on MSDN forums since I last visited them.

    Moderator - Kind request, can you please revert this post to ASP.Net forums?

    Thank you all,

    Best wishes


    .Net Frenzy

    Friday, December 06, 2013 6:08 AM