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

RadDatePicker repeated javascript on page

4 Answers 98 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 06 Feb 2009, 03:51 PM
Hi,

I am using Telerik.Web.UI dll version 2008.3.1314.  I am experiencing an issue when I put several RadDatePickers on a single page.  I have about 133K of javascript that looks like the code below.  This is repeated for each and every RadDatePicker on the page, and there are many.  Is there any way for this to be condensed?  I was previously experiencing an issue where there was repeated inline CSS for each RadCalendar on the page, which I learned was an issue with version 2008.3.1125, and that is why I upgraded to 2008.3.1314.  The CSS issue was fixed, but this repeated script remained.  Any ideas?

 

Sys.Application.add_init(function() {  
    $create(Telerik.Web.UI.RadDatePicker, {"_PopupButtonSettings":{  ResolvedImageUrl : "", ResolvedHoverImageUrl : ""},"_popupControlID":"extendedDataForm_ctl12_234178_extendedField_Immun_DipTetPert_3_datePicker_popupButton","clientStateFieldID":"extendedDataForm_ctl12_234178_extendedField_Immun_DipTetPert_3_datePicker_ClientState","focusedDate":"2009-02-06-00-00-00","maxDate":"9999-12-31-00-00-00","minDate":"1753-01-01-00-00-00"}, null, {"calendar":"sharedRadCalendar","dateInput":"extendedDataForm_ctl12_234178_extendedField_Immun_DipTetPert_3_datePicker_dateInput"}, $get("extendedDataForm_ctl12_234178_extendedField_Immun_DipTetPert_3_datePicker"));  
});  
Sys.Application.add_init(function() {  
    $create(Telerik.Web.UI.RadDateInput, {"_focused":false,"_originalValue":"7/22/1994 12:00:00 AM","_postBackEventReferenceScript":"__doPostBack(\u0027extendedDataForm$ctl13$234178_extendedField_Immun_DipTetPert_4$datePicker\u0027,\u0027\u0027)","clientStateFieldID":"extendedDataForm_ctl13_234178_extendedField_Immun_DipTetPert_4_datePicker_dateInput_ClientState","dateFormat":"M/d/yyyy","dateFormatInfo":{"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"AMDesignator":"AM","PMDesignator":"PM","DateSeparator":"/","TimeSeparator":":","FirstDayOfWeek":0,"DateSlots":{"Month":0,"Year":2,"Day":1},"ShortYearCenturyEnd":2029,"TimeInputOnly":false},"displayDateFormat":"M/d/yyyy","enabled":true,"incrementSettings":{InterceptArrowKeys:true,InterceptMouseWheel:false,Step:1},"styles":{HoveredStyle: ["width:100%;vertical-align:middle;""riTextBox riHover field"],InvalidStyle: ["width:100%;vertical-align:middle;""riTextBox riError field"],DisabledStyle: ["width:100%;vertical-align:middle;""riTextBox riDisabled field"],FocusedStyle: ["width:100%;vertical-align:middle;""riTextBox riFocused field"],EmptyMessageStyle: ["width:100%;vertical-align:middle;""riTextBox riEmpty field"],ReadOnlyStyle: ["width:100%;vertical-align:middle;""riTextBox riRead field"],EnabledStyle: ["width:100%;vertical-align:middle;""riTextBox riEnabled field"]}}, {"error":function() {  
                                                                                document.getElementById('extendedDataForm_ctl13_234178_extendedField_Immun_DipTetPert_4_invalidDateHidden').value = document.getElementById('extendedDataForm_ctl13_234178_extendedField_Immun_DipTetPert_4_datePicker_dateInput_text').value;  
                                                                            }}, null, $get("extendedDataForm_ctl13_234178_extendedField_Immun_DipTetPert_4_datePicker_dateInput"));  
}); 

4 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 06 Feb 2009, 03:52 PM
Also note that I am already using a shared calendar between the DatePickers, and successfully.
0
Nikolay Rusev
Telerik team
answered on 09 Feb 2009, 02:45 PM
Hello John,

The code which you posted is generated by ASP.NET AJAX framework in order to create all client-side object of all ajax enabled controls on the current page. You can find more information on the link below:

Sys.Component $create Method

Sincerely yours,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
John
Top achievements
Rank 1
answered on 09 Feb 2009, 03:03 PM
Thanks.  I'm wondering, in turn, if it would be possible to compile all of the $create calls into a single call to add_init?  Any reason add_init needs to be called for each control?
0
Vlad
Telerik team
answered on 10 Feb 2009, 03:02 PM
Hi John,

Generally this is how Microsoft ASP.NET AJAX works. You (and we) cannot customize this much!

Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Calendar
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Vlad
Telerik team
Share this question
or