RadDatePicker culture issue

9 posts, 0 answers
  1. Mak
    Mak avatar
    39 posts
    Member since:
    Oct 2008

    Posted 28 Apr 2011 Link to this post

    Hi there,

    We currently use RadDatePicker / Calendar to get a user input of the current date. We have followed the tutorials accordingly and setup different rules such as DisplayDateFormat and DateFormat.

    We are currently experiencing a problem on certain machines where the DateFormat rule is not followed! (i.e. when the selected date is stored in a property, it is stored in U.S. culture, even though we have explicitly stated that the RadDatePicker use U.K format and that the stored DateFormat is "dd/MM/yyyy")

    Is there anything else that we need to set in order to ensure that the properties are applied to all? Would you recommend this is done in code-behind rather than setting it on design-side? What machine settings are likely to override the properties set for the RadDatePicker?

    Code attached below:

    <telerik:RadDatePicker ID="radDateAssessment" runat="server" Culture="English (United Kingdom)" EnableTyping="True">
    <Calendar runat="server" 
    UseRowHeadersAsSelectors="False"
    UseColumnHeadersAsSelectors="False"
    ViewSelectorText="x">
    </Calendar>
    <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
    <DateInput runat="server" 
     DisplayDateFormat="dd-MMM-yyyy"
    DateFormat="dd/MM/yyyy">
        </DateInput>
    </telerik:RadDatePicker>


    Hope you can be of help

    Regards

    Ahmed
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 03 May 2011 Link to this post

    Hello Ahmed,

    The described behaviour is actually expected as on the server the DatePicker control will pass a Date object which is with the default culture of the application. One possibility to overcome this beahviour is to set the needed culture in the globalization tag into your web.config. Another option is to format the object by using String.Format when the object is assign to a property on the server and cast to String.

    I hope this helps.

    All the best,
    Maria Ilieva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Mak
    Mak avatar
    39 posts
    Member since:
    Oct 2008

    Posted 03 May 2011 Link to this post

    Hi there,

    You say: The described behaviour is actually expected as on the server the DatePicker control will pass a Date object which is with the default culture of the application.
    But yet we cant understand how the default culture of the application overrides the culture setting explicitly set for the control? Also in our application we have set the default culture in the global.asax.vb code, and have set it to be by default Application("DefaultLanguage") = "en". We dont actually explicitly set the culture in the globalization tag of the web.config.

    One thing we have noticed is that this only seems to apply to IIS7 hosted instances where the RadDatePicker is used. Do you by any chance know which setting might be affecting the behaviour of the RadControl??

    Regards

    Ahmed
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 10 May 2011 Link to this post

    Hello Ahmed,

    My local tests shows that the described behaviour could be replicated no matter if the site is uploaded in IIS7 ro not and as I mentioned this is the default behaviour of the control. As I previously mentioned the proper way for setting the application culture is to do it in the web.config file. If this doesn't help, please suggest opening regular support ticket and sand us the problematic application which replicates the issue only under IIS7. Thus we will be able to test it locally and od our best to provide more to-the-point solution.

    Greetings,
    Maria Ilieva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Mak
    Mak avatar
    39 posts
    Member since:
    Oct 2008

    Posted 20 Jun 2011 Link to this post

    Hi there

    After a series of investigations, we've identified the problem as a result of the Invariant Culture property in IIS7.

    Do you have any recommendations for using the Invariant Culture? or will we have to request that our clients change their IIS7 culture settings for the web application so that it is a specific culture e.g. en-GB or en-US.

    Does the control itself support something like Culture="English (Invariant)" or CultureInfo=...

    Hope to hear from you soon

    Regards

    A.
  6. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Jun 2011 Link to this post

    Hello Ahmed,

    Note that the InvariantCulture and the "en-US" cultures are very similar for the most part. The only difference in both is in the currency symbol they are using. We do not support something like  Culture="English (Invariant)" so I would suggest you to set the IIS7 culture settings for the web application so that it is a specific culture e.g. en-GB or en-US.


    Best wishes,
    Maria Ilieva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Jun 2011 Link to this post

    Hello Ahmed,

    Note that the InvariantCulture and the "en-US" cultures are very similar for the most part. The only difference in both is in the currency symbol they are using. We do not support something like  Culture="English (Invariant)" so I would suggest you to set the IIS7 culture settings for the web application so that it is a specific culture e.g. en-GB or en-US.


    Best wishes,
    Maria Ilieva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  8. atul
    atul avatar
    7 posts
    Member since:
    Apr 2011

    Posted 05 Oct 2011 Link to this post

    Hi,

    Im using raddatepicker and i want to set the dataforamt string for that. But in my case i got the appsetting for formats in my webconfig. Please look below
     <appSettings>
        <add key="LongDateDisplayFormat" value="dddd, MMMM dd, yyyy"/>
        <add key="ShortDateDisplayFormat" value="dd-MMM-yyyy"/>
        <!--<add key="ShortDateDisplayFormat" value="{0:yyyy-MMM-dd}"/>-->
        <add key="DateTimeDisplayFormat" value="yyyy-MMM-dd hh:mm:ss"/>
     </appSettings>

    Now Is there anyway i can assign this app setting in page source for raddatepicker. Please keep in mind i want to do that from page source only not from code behind.

     <telerik:RadDatePicker ID="RadDatePicker1" runat="server" OnPreRender="RadDatePicker1_OnPreRender">
            <DateInput runat="server" DateFormat="WANT TO ACCESS MY APP SETTING VALUE HERE">
            </DateInput>
        </telerik:RadDatePicker>

    It is urgent. 

    Kind Regards,
    Atul Chaudhary
  9. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 10 Oct 2011 Link to this post

    Hi Atul,

    Please review the following online resources which elaborates on this matter:
    http://stackoverflow.com/questions/4056827/how-to-read-web-config-app-key-settings-in-html-markup

    I hope this helps.

    Regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top