Calendar extender format="dd.MM.yyyy"?

 Hi.

 I have one question about date format in ajax toolkit calendar extender. I want to set the format to "dd.MM.yyyy"

because thats the format I need to insert into database.

 Here is my test code:

<%@ Page Language="C#" MasterPageFile="~/master.master" AutoEventWireup="true" 
CodeFile="Default.aspx.cs" Inherits="_Default" Title="test" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Label ID="Label1" runat="server" Text="Datum:"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1"
Animated="true" Format="dd.MM.yyyy" PopupButtonID="Image1"></cc1:CalendarExtender>


<asp:ImageButton ID="Image1" ImageUrl="~/calbutton.png" ImageAlign="AbsMiddle" Width="18px"
runat="server"/>


<cc1:MaskedEditExtender ID="MaskedEditExtender1" CultureName="sl-SI" ClearTextOnInvalid="false"
runat="server" Mask="99.99.9999" MaskType="Date" TargetControlID="TextBox1" AutoComplete="true"> 
</cc1:MaskedEditExtender>

<cc1:MaskedEditValidator ID="MaskedEditValidator1" runat="server"
ControlExtender="MaskedEditExtender1" ControlToValidate="TextBox1" InvalidValueMessage="Invalid date!">
</cc1:MaskedEditValidator>
</asp:Content>

  

I would really appreciate if someone tells/expplain me why format dd.MM.yyyy is not working.

I mean I can write into textbox but if I want to get date from calendar extender there is an error (it does not fill textbox with the selected date from calendar)

 

Am I missing something bigger (web.config etc.)? 

 thx

 

0
JohnS176
3/27/2009 1:02:19 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

5 Replies
1653 Views

Similar Articles

[PageSpeed] 42

 You're close - try Format="dd/mm/yyyy".


~ Nicole

Always looking, always learning.
Full-time web developer coding in VB.net
0
rcg26
3/27/2009 1:17:20 PM

 Hi Friend,

try to use the Following code and style.

<cc1:CalendarExtender ID="ceDate" runat="server" TargetControlID="txtDate"
                                Format="dd-MM-yyyy">

 

 


Enjoy Smile

Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.

Regards,
Bhaumik
0
vora_bhaumik
3/27/2009 1:22:06 PM

 thx rcq26 but I've already tried that.

I get the same error.

Textbox does not fill when I select the date from calendar.

 ----------------------------------------------------------------------------------

EDIT:  vora_bhaumik thx...but I already tried that before too. And still not working.

 

The result of what I want is is actually in sample pages of ajax toolkit: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Calendar/Calendar.aspx

(the 3rd textbox)  How is it done there?

It shows the format for my country and also all the calendar names (months, years) are in my country language. Which "special" settings are done there?
0
JohnS176
3/27/2009 1:23:36 PM

 Sounds like you have some localization settings in place. From that page you linked:

The page uses the culture setting English (United States) which was specified by the browser. The page properties have Culture="auto" and UICulture="auto" set to enable the same. See this MSDN article for more information. The ScriptManager on this Calendar demo page has EnableScriptGlobalization="true" and EnableScriptLocalization="true".

 


~ Nicole

Always looking, always learning.
Full-time web developer coding in VB.net
0
rcg26
3/27/2009 2:33:15 PM

 thx rcq26. That is exactly what I needed.

 It works fine now.

SOLVED!

0
JohnS176
3/27/2009 3:23:43 PM
Reply:

Similar Artilces:

how can i convert the string from "21/12/2005" which is in dd/MM/yyyy format to MM/dd/yyyy
hi all i would like to convert a string that is when user type in the textbox let say "21/12/2005" in dd/MM/yyy and convert to MM/dd/yyyy . how do it do that ?Karen Dim dt As DateTime = txtInput.Text txtOutput.Text = dt.ToString("MM/dd/yyyy")think this should do it Dim strDate(3) as String Dim strDateNewFormat as String strDate = txtDate.text.split("/"c) strDateNewFormat = strDate(1) & "/" & strDate(0) & "/" & strDate(2) ThanksDinuj Nath Try this link for sample code.  Hope this helps.   http://msdn.microsoft.com/library/default.asp?url=/libr...

MaskedEditExtender date format problem ("yyyy-MM-dd" with cultureName="sv-SE" doesn't work)
Hi All, I need to create MaskedEditExtender for Sweden date which uses format "yyyy-MM-dd". I have the following code below. CalendarExtender doesn't work with current MaskedEditExtender. Also the validation doesn't work properly. <asp:TextBox ID="txtFSFV" MaxLength="100" style="width:70px" runat="server" /> <asp:HyperLink ID="hplGetCalendar" NavigateUrl="javascript:void(null)" runat="server"> <img src="~/images/calendar.png" runat...

format Date field in Dataset to "mm/dd/yyyy"
Currently I have a query that is populating a dataset with a date value. Here is my code:  With cmd .CommandText = "SELECT pEff_Dt FROM MyTable WHERE condition1 = condition2" .Parameters.Add(BMItemno) .Connection = SQLConn .CommandType = CommandType.Text End With adapter.SelectCommand = cmd adapter.Fill(dsEffDate) How can I access the only date field passed to my dataset (pEff_Dt) and format it to "mm/dd/yyyy"? Currently is formated to Sat Sep 30 16:31:33 PDT 2006 Any suggestions?  Victor A. Pa...

how to get date in "dd/mm/yyyy" using C#.net?
Hi I have  textbox, while page loads, by default this texbox need to be with today's date in "dd/mm/yyyy"  format... Can anyone suggest how to do this using c#.net. Thanks aviThanks and RegardsAvinashavicool08@gmail.com  <body>    <form id="form1" runat="server">    <div>    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>    </div>            </form></body...

How to display "dd-mm-yyyy" format from database to text box ?
Hi How to display "dd-mm-yyyy" format from database to text box ? i have written like this but i m not getting the expected op. txtDate.Text= string.Format(ds.Tables[0].Rows[0]["NewsDate"].ToString(),"dd-mm-yyyy");Chandra Dev go through this.... http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspxChinna_sv... Try like this: txtDate.Text= ds.Tables[0].Rows[0]["NewsDate"].ToString("dd-MM-yyyy"); By the way, I advise that you check for nulls, prior to doing this, just to be safe (especially is NewsDate fields can be null).C# ...

How to convert format of a DateTime object to "yyyy-MM-dd" style
Hi all, i have a date in string data type. i m using Convert.ToDateTime function to convert this string date to DateTime object. When i get this date as a DateTime object it is in "dd-MM-yyyy" format. but i want to convert its format to "yyyy-MM-dd". Can anyone tell me how to convert the format of a DateTime object. I don't want the format with string data type. Please help me. Thanks in advance. once you got your object just do a .ToString("yyyy-MM-dd") on the end of it. Otherwise you'll probably have to change your server settings to be that f...

How to validate date time format must be "yyyy/mm/dd"?
I use VS2003 , C# In my Layout have a TextBox for user to input Publish Datethe date time format must as "yyyy/mm/dd"layout like belowPublish Date | TextBox |   ex:2008/09/22but sometimes user just input 20080922 or 97/09/22 and so on...how to validate this TextBox must as "yyyy/mm/dd"?thank you very much you can accept the date as long as it is valid, and then convert it to whatever format you want. Here are 2 options to validate Date 1) The CompareValidator is an option, use Operator=DataTypeCheck and Type=Date for Validator 2) RegularExpression...

Problem in Date Comparison with Compare Validator in "dd/MM/yyyy" format
I want to compare dates  for that I have taken two textboxes in which dates are coming through ajax calendar in "dd/MM/yyyy" format I am using compare validator  for comparing with condition that value in textbox2 should be greater than textbox 1  in textbox1 if I enter date suppose"10/03/2008"  and in textbox 2  "11/03/2008" it works fine But in textbox1 if I enter "20/02/2008" and in textbox 2 "11/03/2008" it doesn't works and give message "value in textbox2 should be greater than textbox 1&quo...

ToString("dd/MM/yyyy hh:mm:ss") question
When I retrieved a column in a database which is of type DATETIME, it returns the date in the format MM/dd/yyyy hh:mm:ss I write some code to display the datetime as dd/MM/yyyy hh:mm:ss but the AM or PM part is gone. What should I do to get the AM/PM part displayed? My code: dim lmd as datetime = Convert.ToDateTime(dr("LastModifiedDate"))lastModifiedDate.Text = lmd.ToString("dd/MM/yyyy hh:mm:ss")   Thanks "dd/MM/yyyy hh:mm:ss tt"  <- Notice the 'tt' at the endDarrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you! From the online ...

DataFormatString="{0:dd-MM-yyyy HH:mm}" not displaying military time on remote server
I have a boundfield as follows: <asp:BoundField DataField="PAStatusDate" DataFormatString="{0:dd-MM-yyyy HH:mm}" HeaderText="PA Status Date" HtmlEncode="False" /> When I build this app on my local PC the time portion correctly displays in military time, ie 15:32.When I run this code on my remote server, the time is displayed as 03:32.I have tested variations using h, hh, H, HH and in all instances the remote server displays 3:32 (either with/without leading zero).I tried changing the regional settings on the server to use format ...

"Date" mm/dd/yyyy not showing up
Name: Laurie Muntean Email: DogzRpeepL2atohdotrrdotcom Product: Thunderbird Summary: "Date" mm/dd/yyyy not showing up Comments: As of today, the date does not show when the email was received, just shows the "time" received, could care less about the time. I need to know what DAY the email came!!!??? What to do?? Thanks, Laurie Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 ...

Difference between "new" calendar and "opening" a calendar
I'm getting Lightning set up in a small business. Everything looks OK, but I'm a little confused about some of the instructions I'm seeing. I've created two calendars so far and saved them as .ics files on the network. One will be a company calendar to show vacations, holidays, people out sick, etc. The other will be my personal calendar, but I'll still want to make most events public because my coworkers need to know what times I'm available for training. Given that these preexisting .ics files already exist on the network, is there any difference between...

Wish: show "calendar" and "calendars" at the same time
Hi, I am really impressed with the calendar and am starting to use it seriously. Thanks and well done. At our office we make good use of multiple calendars, ticking and unticking them to see different categories of event. Because "calendar" (current month) and "calendars" (which calendars to view) are tabs, you can't see them both at the same time. Could "calendars" move down so it is a section between "calendar" and "tasks"? People like me could choose to view both of them. Others could hide "calendars" by dr...

How can I return a valid date format when I use a date in "dd-mmm-yyyy" format with US location
When I have Regional setting Location = English (Australia) and Input language = English (Australia) and short date fomat = dd/mmm/yyyy the statement date("01-Jan-2004") returns 1-Jan-2004. When I have Regional setting Location = English (US) and Input language = English (US) and short date fomat = d/m/yyyy the statement date("01-Jan-2004") returns 1/1/1900. How can I get PB8 to return 1/1/2004 when I run the statement date("01-Jan-2004") with US Windows regional settings? Instead of date("29-Jan-2004"), you need to use date(2004, 1, 29). ...