Click here to Skip to main content
13,141,747 members (56,750 online)
Rate this:
 
Please Sign up or sign in to vote.
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 24-Sep-12 16:10pm
musiw732

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

<asp:TextBox runat="server" ID="Date1" autocomplete="off" /><br />
       <ajaxToolkit:CalendarExtender ID="defaultCalendarExtender" runat="server" TargetControlID="Date1" Format="dd/MM/yyyy"  />
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100