Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

i have a question..actually it's been a week i try to solved it.in my web page i use ajax calendar toolkit to get the date entered by user.but the calendar toolkit displayed mm/dd/yyyy..while sqlserver stored it as dd/mm/yyyy (which is great becasue thats the way i want it store.)

the question is how to change the date that displayed on that calendar toolkit.in sqlserver data type is datetime.so it store date & time.

i change format on calendar toolkit properties to dd/MM/yyyy,import namespace globalization, also in web config..change to en-GB.but when i enter submit button this error come out: "Arithmetic overflow error converting expression to data type datetime"

i have to change as i my UAT is already run.and user comment on the date field.please help me on this.

thanks in advance.
musiw.
Posted

1 solution

you can change date format using following syntx......

XML
<asp:TextBox runat="server" ID="Date1" autocomplete="off" /><br />
       <ajaxToolkit:CalendarExtender ID="defaultCalendarExtender" runat="server" TargetControlID="Date1" Format="dd/MM/yyyy"  />
 
Share this answer
 
Comments
musiw 25-Sep-12 12:40pm    
it's not working.i already mentioned above, i tried to change the format.the error still appear.
musiw 25-Sep-12 13:50pm    
code behind:

cmd.Parameters.AddWithValue("@start_date", date3.Text)
cmd.Parameters.AddWithValue("@due_date", date4.Text)
cmd.ExecuteNonQuery()

code aspx:
<tr>
<td>
<asp:TextBox ID = "date3" runat="server" Font-Names="Arial" autocomplete="off" >  <asp:Label ID="Label37" runat="server" ForeColor="Red"
Text="* ">


<asp:CalendarExtender ID="CalendarExtender1" runat="server" Enabled="True" TargetControlID="date3" DaysModeTitleFormat="MMMM, yyyy" StartDate="01/01/2012" Format="dd/MM/yyyy" TodaysDateFormat="dd/MM/yyyy">

 <asp:Label ID="Label30" runat="server" Font-Names="Arial"
ForeColor="Red">

</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label21" runat="server" Font-Names="Arial"
Text="End Date:">
</td>
<td>
<asp:TextBox ID = "date4" runat="server" Font-Names="Arial"
>  <asp:Label ID="Label38" runat="server" ForeColor="Red"
Text="* ">

<asp:CalendarExtender ID="CalendarExtender2" runat="server" Enabled="True" TargetControlID="date4" DaysModeTitleFormat="MMMM, yyyy" StartDate="01/01/2012" OnClientDateSelectionChanged="ValidateDate" Format="dd/MM/yyyy" TodaysDateFormat="dd/MM/yyyy">

 <asp:Label ID="Label31" runat="server" Font-Names="Arial"
ForeColor="Red">

</td>
</tr>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900