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

[Solved] Html.Telerik().ScriptRegistrar() in ViewUserControlPage

3 Answers 202 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.
Jose Granja
Top achievements
Rank 1
Jose Granja asked on 02 Mar 2010, 10:50 AM
Hi,

I've got a Master Page file with the following definition:

<% 
            //Plugins: Autocomplete, Form, Tootlip, UI 
            Html.Telerik().ScriptRegistrar().DefaultGroup( 
                                    group => 
                                    group.Add("jquery.qtip-1.0.0-rc3.min.js") 
                                    .Add("jquery-ui-1.7.2.custom.min.js") 
                                    .Add("jquery.form.js") 
                                    .Add("jquery.autocomplete-min.js") 
               ).OnDocumentReady(() => 
                                      {%> 
                                       //Functions here 
                                      <%} 
                       ) 
               .Render(); 
        %> 


Then I have a page Loaded by ajax and I would like to use the ScriptRegistered in the Master file.

I tried copying this code into the Ajax Page but it won't work. any ideas? thank you




3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 02 Mar 2010, 10:54 AM
Hello Jose Granja,

Unfortunately this is not possible. You cannot dynamically load JavaScript assets using Ajax.

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
Jose Granja
Top achievements
Rank 1
answered on 02 Mar 2010, 11:03 AM
It doesn't have to be necessary the same assets of the master page! I just want to load jquery and the confirmation pluguin because in the loaded  page there's a button that needs confirmation (and I want to use this cool pluguin)! There is no way to use jquery in the ajax loaded page?? My app uses a lot of ajax request and I would be needing to add jquery in the future.

The first solution that springs in my mind is to add the pluguin to the button once the page is loaded but that doesn't look pretty at all. I want the page to be "independent". 

thank you for you quick reply

PS: and excuse my bad english
0
Atanas Korchev
Telerik team
answered on 02 Mar 2010, 11:57 AM
Hi Jose Granja,

You need to somehow programmatically include the required JavaScript files after updating the HTML via ajax. Simply registering them with <script> tags will not work. The getScript jQuery method does that but of course jQuery must be registered beforehand. Here a different approach is documented which does not rely on jQuery.

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.
Tags
General Discussions
Asked by
Jose Granja
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jose Granja
Top achievements
Rank 1
Share this question
or