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 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