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

[Solved] Ajax script conflict with ScriptRegistrar

11 Answers 249 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sameer M
Top achievements
Rank 1
Sameer M asked on 17 Feb 2010, 09:42 PM
I am having an issue where I am using Ajax toolkit Calendar control in my Views.

<input id="dob" name="dob" type="text" value="15/03/1977" /> 
                <script type='text/javascript' src='../../Scripts/jquery-1.3.2.js'></script> 
  
  
<script type='text/javascript' src='../../Scripts/AjaxToolkit/Start.debug.js'></script> 
  
  
<script type='text/javascript' src='../../Scripts/AjaxToolkit/extended/ExtendedControls.debug.js'></script> 
  
  
<script type='text/javascript'>  
var link=document.createElement('link') 
link.setAttribute('type', 'text/css'); 
link.setAttribute('rel', 'stylesheet'); 
link.setAttribute('href', '../../Scripts/AjaxToolkit/extended/Calendar/Calendar.css'); 
var head = document.getElementsByTagName('head')[0]; 
head.appendChild(link); 
</script> 
  
<script type='text/javascript'>  
Sys.debug = true
Sys.require(Sys.components.calendar, function(){$("#dob").calendar({_format: "dd/MM/yyyy"})}); 
</script> 
 

The above script for calendar control is generated with use of HTML helper when there is no telerik setting in my site.master file. The issue is as soon as I added
 <%= Html.Telerik().ScriptRegistrar() %> in my site.master file my calendar control stop working and starts throwing errors. Firebug shows that the javascripts associated with Ajax calendar control is not getting attached to the field.


I would like to use Telerik and Ajax controls in my website. Can you please help.

11 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 18 Feb 2010, 07:49 AM
Hi Sameer M,

Are you loading the JavaScript files with the ScriptRegistrar? If yes this might be the problem - the calendar probably expects its scripts to be loaded earlier. As a workaround I may suggest you continue to manually register the calendar JavaScript files.

Regards,
Atanas Korchev
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
Sameer M
Top achievements
Rank 1
answered on 18 Feb 2010, 09:32 AM
Hi Atanas,

Sorry but I am not very clear. Are you suggesting not to use <%= Html.Telerik().ScriptRegistrar() %> in site.master, can you please provide an example of how to manually register javascript files associated with calendar control. Is this a setting in ScriptRegistrar..

Thanks,
Sameer
0
Atanas Korchev
Telerik team
answered on 18 Feb 2010, 09:43 AM
Hi Sameer M,

No, you should not remove the ScriptRegistrar. Unfortunately I am not sure what the problem is unless I somehow reproduce it. Could you attach a runnable project so we can test? To do so you need to open a support ticket or host the source in some public location.

Regards,
Atanas Korchev
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
Sameer M
Top achievements
Rank 1
answered on 18 Feb 2010, 11:50 AM
Unfortunately I dont have any public domain where I can host these files. If you can provide me an email id, I can email the file to you its less than 2mb. I am just doing a proto, but if its not working I will have to go with regular MVC with Ajax.

Thanks,
Sameer
0
Atanas Korchev
Telerik team
answered on 18 Feb 2010, 12:29 PM
Hi Sameer M,

You can mail me the project at atanas.korchev at telerik.com

Regards,
Atanas Korchev
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
Sameer M
Top achievements
Rank 1
answered on 18 Feb 2010, 10:36 PM
Thanks Atanas for you help..

For benifit of others - The problem was resolved by adding <% Html.Telerik().ScriptRegistrar().jQuery(false); %> in the page header where Ajax control exists.
0
Marc Gibian
Top achievements
Rank 1
answered on 25 Mar 2010, 11:13 PM
I am experiencing this same problem when using the DatePicker. The fix described as:

<% Html.Telerik().ScriptRegistrar().jQuery(false); %>

does allow my ajax behavior to work, but breaks the DatePicker ... as in, clicking on the DatePicker area no longer causes the DatePicker calendar to display.  I really need both behaviors to work ... my jQuery based ajax AND my Telerik DatePicker.

Thanks for your help with this,
Marc



0
Atanas Korchev
Telerik team
answered on 26 Mar 2010, 09:14 AM
Hi Marc Gibian,

We would need additional information in order to provide help
  1. Which version of Telerik Extensions for ASP.NET MVC are you using?
  2. Which version of jquery are you including manually?
  3. Could you paste the relevant source code here?

Regards,
Atanas Korchev
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
Marc Gibian
Top achievements
Rank 1
answered on 26 Mar 2010, 08:12 PM
Which version of Telerik Extensions for ASP.NET MVC are you using?

       Q1 2010

Which version of jquery are you including manually?

       1.3.2

Could you paste the relevant source code here?

       I am not sure which code you are looking for. This is part of a large application. Guessing you might want the DatePicker specific code from my .aspx file:

                                        <%= Html.Telerik().DatePicker() 
                                                          .Name("SearchDatePicker") 
                                                          .InputHtmlAttributes(new {@class="t-input tip_text", @size="9"}) 
                                                          .Value(Model.DatePickerDefaultDate) 
                                                          .MinDate(DateTime.Now) 
                                        %> 
 



0
Atanas Korchev
Telerik team
answered on 27 Mar 2010, 07:55 PM
Hello Marc Gibian,

Q1 2010 is built using jquery 1.4.2 and you cannot use older versions with it. Please try including jquery 1.4.2.

Best wishes,
Atanas Korchev
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
Marc Gibian
Top achievements
Rank 1
answered on 31 Mar 2010, 11:18 PM
We have upgraded our application to jquery 1.4.2 and things do indeed appear to be working properly.
Tags
General Discussions
Asked by
Sameer M
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Sameer M
Top achievements
Rank 1
Marc Gibian
Top achievements
Rank 1
Share this question
or