This is a migrated thread and some comments may be shown as answers.

UI Culture changes back after some time

15 Answers 272 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 19 Jan 2010, 11:58 AM
Hello,

I am using RadScheduler in ASP.NET MVC - WebService binding. I am setting culture in OnLoad event, but this setting is reverted to English culture after some time (usually 2-3s). I observed, that it happens after my SchedulerProvider method GetAppointments(RadScheduler owner) is called, but not sure.
Do You have any clue what is wrong with that?I am stuck on this for a while.

Thank You

Here is my sample code:

<script runat="server">  
protected override void OnLoad(EventArgs e) 
    { 
       
        // Set appropriate culture for calendar 
        RadScheduler1.Culture = CRM.Web.Code.Globalization.GlobalizationManager.CurrentUICulture; 
         
      
        // Set first and last day of a week 
        switch (RadScheduler1.Culture.ToString()) 
        { 
            case "en-US": 
                RadScheduler1.FirstDayOfWeek = DayOfWeek.Sunday; 
                RadScheduler1.LastDayOfWeek = DayOfWeek.Saturday; 
                break; 
            default: 
                RadScheduler1.FirstDayOfWeek = DayOfWeek.Monday; 
                RadScheduler1.LastDayOfWeek = DayOfWeek.Sunday; 
                break; 
        } 
 
        RadScheduler1.ShowAllDayRow = Model.ShowAllDayEvents; 
        RadScheduler1.WorkDayStartTime = Model.WorkDayStartTime; 
        RadScheduler1.WorkDayStartTime = Model.WorkDayEndTime; 
        RadScheduler1.DayStartTime = Model.DayStartTime; 
        RadScheduler1.DayEndTime = Model.DayEndTime; 
 
 
        // Export iCalendar 
        SchedulerAppointmentContextMenu.Items[0].Text = "ExportICalendar".GetLocalizedGlobal(); 
 
        // Delete 
        SchedulerAppointmentContextMenu.Items[2].Text = "Delete".GetLocalizedGlobal(); 
        base.OnLoad(e); 
        
    } 
    public override void VerifyRenderingInServerForm(Control control) 
    { 
 
    } 
</script> 
   <telerik:RadCodeBlock runat="server" ID="InitialScriptCodeBlock1"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"  
            EnableScriptGlobalization="true" /> 
 
            <telerik:RadScheduler runat="server" ID="RadScheduler1" AllowDelete="false" AllowEdit="true" RowHeight="16px"   
                AllowInsert="false" MinutesPerRow="15" StartEditingInAdvancedForm="false" StartInsertingInAdvancedForm="false" 
                OnClientAppointmentDoubleClick="OnClientAppointmentDoubleClick" OnClientTimeSlotClick="OnClientTimeSlotClick" OnClientAppointmentWebServiceUpdating="" 
                OnClientAppointmentDeleting="OnClientAppointmentDeleting" OnClientAppointmentDataBound="OnClientAppointmentDataBound" 
                Height="900px" OnClientAppointmentEditing="OnClientAppointmentEditing" OnClientAppointmentContextMenuItemClicked="appointmentContextMenuItemClicked" 
                SelectedView="WeekView" DayHeaderDateFormat="dddd, dd MMMM yyyy" HoursPanelTimeFormat="HH:mm"
                <AppointmentContextMenus> 
                    <%--The appointment context menu interaction is handled on the client--%> 
                    <%--See the JavaScript code above--%> 
                    <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerAppointmentContextMenu"
                        <Items> 
                            <telerik:RadMenuItem Text="Export iCalendar" Value="GenerateVCal" ImageUrl="~/Content/Images/Icons/iCalendar16.png" /> 
                            <telerik:RadMenuItem IsSeparator="True" /> 
                            <telerik:RadMenuItem Text="Delete" Value="CommandDelete" ImageUrl="~/Content/Images/DataEditing/Delete.gif" 
                                Enabled="True" /> 
                        </Items> 
                    </telerik:RadSchedulerContextMenu> 
                </AppointmentContextMenus> 
                <TimelineView GroupBy="Calendar" GroupingDirection="Vertical" /> 
               
                <AdvancedForm Enabled="false" EnableResourceEditing="false" /> 
                <WebServiceSettings Path="~/Models/SchedulerWebService.asmx" ResourcePopulationMode="ServerSide" /> 
            </telerik:RadScheduler> 
        
    </telerik:RadCodeBlock> 
 

15 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 21 Jan 2010, 05:02 PM
Hi Jan,

Thank you for sending detailed problem description.

In order for the client-side RadScriptManager globalization to work you must also set the Page culture to be the same as that of RadScheduler:

// Set appropriate culture for calendar
RadScheduler1.Culture = CRM.Web.Code.Globalization.GlobalizationManager.CurrentUICulture;
Page.Culture = RadScheduler1.Culture.ToString();

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jan
Top achievements
Rank 1
answered on 21 Jan 2010, 05:12 PM
Hello,

thank You for Your reply. I have tried what You suggested, but with no success :( It is ok for few seconds and then it turns back to English.
Do You have another tip what could be wrong with my code?

Thank You Jan
0
T. Tsonev
Telerik team
answered on 21 Jan 2010, 05:30 PM
Hello Jan,

Can you try setting the Page culture declaratively as described here:

http://msdn.microsoft.com/en-us/library/bz9tc508.aspx

Also can you check the value of Sys.CultureInfo.CurrentCulture variable in the browser? If it matches your set culture the scheduler should render correctly.

All the best,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jan
Top achievements
Rank 1
answered on 26 Jan 2010, 02:10 PM
Hello,

I did exactly what You have suggested, but still with no luck. I have culture "cs-CZ" set in my browser. I found out, that the culture changes back to "en-US" in GetAppointments(RadScheduler owner)   method, but I can´t figure out the reason.

Kind regards Jan


0
Peter
Telerik team
answered on 27 Jan 2010, 01:20 PM
Hi Jan,

Could you please try the following help topic and let us know if it helps:
http://www.telerik.com/help/aspnet-ajax/localization-web-services-mode.html ?


Greetings,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jan
Top achievements
Rank 1
answered on 27 Jan 2010, 02:23 PM
Hello,

Thank You for Your reply. I have tried to set culture manualy, but it does not work for me.
Could this error occur while I am using custom ResourceProviderFactory ? I forget, that Your controls should need default one.
If so, is there any workaround?

<globalization enableClientBasedCulture="false" resourceProviderFactoryType="CRM.Localization.LocalizedResourceFactory, CRM.Localization" uiCulture="cs-CZ" culture="cs-CZ" />
   
Kind regards Jan
0
T. Tsonev
Telerik team
answered on 01 Feb 2010, 09:49 AM
Hello Jan,

The custom resource provider factory shouldn't be a problem - it doesn't seem to be used by the ScriptManager at all.

At the moment, I'm still not convinced that the culture is getting set on the client. Can you paste this in the address bar of the loaded page?
javascript:alert(Sys.CultureInfo.CurrentCulture.name);

If it matches your set culture then the problem is somewhere else. The full page source and/or live URL will help us a lot in tracking it down.

Kind regards,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jan
Top achievements
Rank 1
answered on 02 Feb 2010, 03:46 PM
Hello,

You are right, my client culture does not match the culture, which I have set on the server side. It is weird behavior for me. When I try to show the current culture with this code  <%= System.Threading.Thread.CurrentThread.CurrentCulture.Name %>, everything is ok and it matches the set culture.

I override the culture in my page declaration (Culture="cs-CZ" UICulture="cs-CZ") and also in OnLoad method and in RadScheduler declaration, but nothing helped.
Anyway, I suppose it´s an error in my code somewhere.
Thank You for Your patient help.

Jan
0
Jan
Top achievements
Rank 1
answered on 22 Feb 2010, 09:09 PM
Hello again,

I´m still lost in RadScheduler localization.Thanks to Your help, I found that the problem lies in MicrosoftAjax.js script which is rendered by Telerik_Web_UI_WebResource.
Sys.CultureInfo.CurrentCulture is overriden to "en-US" in this part of the script:
....
if(typeof __cultureInfo==="undefined")var __cultureInfo='{"name":"en-US","numberFormat"
....

My RadScriptManager registration follows:

 <telerik:RadScriptManager ID="RadScriptManager1"
    runat="server"
    EnableScriptGlobalization="true"
    EnableScriptLocalization="true"
     >     </telerik:RadScriptManager>


I get "en-US" when I call : javascript:alert(Sys.CultureInfo.CurrentCulture.name); 
System.Threading.Thread.CurrentThread.CurrentCulture.Name is "cs-CZ "

I really appreciate any help

Kind Regards Jan

P.s I can give You access to my application in case You will need more information.


0
T. Tsonev
Telerik team
answered on 26 Feb 2010, 08:31 AM
Hello Jan,

Apologies for the late reply. I've set the culture on a test page to cs-CZ and this is what I see rendered in the form, right before the MS AJAX scripts are included:

var __cultureInfo = '{"name":"cs-CZ","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":",","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":" ","CurrencySymbol":"Kč","NaNSymbol":"Není číslo","CurrencyNegativePattern":8,"NumberNegativePattern":1,"PercentPositivePattern":1,"PercentNegativePattern":1,"NegativeInfinitySymbol":"-nekonečno","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":",","NumberGroupSeparator":" ","CurrencyPositivePattern":3,"PositiveInfinitySymbol":"+nekonečno","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":",","PercentGroupSeparator":" ","PercentSymbol":"%","PerMilleSymbol":"‰","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"dop.","Calendar":{"MinSupportedDateTime":"\/Date(-62135596800000)\/","MaxSupportedDateTime":"\/Date(253402293599999)\/","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":".","FirstDayOfWeek":1,"CalendarWeekRule":0,"FullDateTimePattern":"d. MMMM yyyy H:mm:ss","LongDatePattern":"d. MMMM yyyy","LongTimePattern":"H:mm:ss","MonthDayPattern":"dd MMMM","PMDesignator":"odp.","RFC1123Pattern":"ddd, dd MMM yyyy HH\u0027:\u0027mm\u0027:\u0027ss \u0027GMT\u0027","ShortDatePattern":"d.M.yyyy","ShortTimePattern":"H:mm","SortableDateTimePattern":"yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\u0027-\u0027MM\u0027-\u0027dd HH\u0027:\u0027mm\u0027:\u0027ss\u0027Z\u0027","YearMonthPattern":"MMMM yyyy","AbbreviatedDayNames":["ne","po","út","st","čt","pá","so"],"ShortestDayNames":["ne","po","út","st","čt","pá","so"],"DayNames":["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],"AbbreviatedMonthNames":["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII",""],"MonthNames":["leden","únor","březen","duben","květen","červen","červenec","srpen","září","říjen","listopad","prosinec",""],"IsReadOnly":true,"NativeCalendarName":"gregoriánský kalendář","AbbreviatedMonthGenitiveNames":["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII",""],"MonthGenitiveNames":["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince",""]}}';

If this is on your page, your localization should be working. We'll be able to check this, as well for any other possible issues, if you can indeed grant us temporary access to the live application.

If all else fails and we can't persuade ASP.NET to render it you can just add this in a script tag right after the opening form tag.

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Philipp
Top achievements
Rank 1
answered on 05 Jan 2012, 04:23 PM
Hi everybody,

first of all a happy new year to Team-Telerik.

Is there a solution for this strange behavior?
I am facing exactly the same problem. Server Side Culture is de-DE and
in clientside AppointmentDatabound javascript returns en-US and the days switch back to US-Format.

Greetings

Philipp
0
Peter
Telerik team
answered on 05 Jan 2012, 05:53 PM
Hi,

If you use a Web Service or a WCF Web Service to populate RadScheduler, please use the approach from this help topic - http://www.telerik.com/help/aspnet-ajax/scheduler-localization-web-services-mode.html.

All the best,
Peter
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
0
S
Top achievements
Rank 1
answered on 17 Dec 2015, 03:36 PM

Hi,

 

If you want to set the Culture that should not change, set that in Application_BeginRequest in your Global.asax.

I had the same issue and this solved by doing above,

0
Anders
Top achievements
Rank 1
answered on 01 Nov 2016, 02:13 PM

Is there any solution to this problem?

How can it be that the Culture setting of RadScheduler does not set the culture of the RAD scheduler?

0
Anton
Telerik team
answered on 02 Nov 2016, 07:43 AM
Hi,

I would suggest to continue our conversation in the other thread you've opened. Also I would ask you avoiding threads duplication for an issue, which allows us to provide you with better support.

Regards,
Anton
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Scheduler
Asked by
Jan
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Jan
Top achievements
Rank 1
Peter
Telerik team
Philipp
Top achievements
Rank 1
S
Top achievements
Rank 1
Anders
Top achievements
Rank 1
Anton
Telerik team
Share this question
or