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

Ajax loading of RadControls

5 Answers 127 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David Ahlbaum
Top achievements
Rank 2
David Ahlbaum asked on 15 Sep 2010, 07:14 AM
Hi Telerik!

In my app I ajaxload everything via jquery. I have my pages in usercontrols wihich I load "virtually" via RenderControl and then send back the html to the browser. This works very well for asp.net-controls but some of your controls have problems with this pattern. Some are displayed incorrectly or not at all and scripts doesn´t seem to work.

I´m  guessing this has to do with "smart" loading of css and javascript. The web resource should just load scripts and css for the controls loaded server side right?

My question is: How can I load the scripts/css I want? Is there any documentation about the different scripts/css inside the assembly? is there something else that I´m missing?

In my source there´s also some javascript injected like: "Sys.Application.add_init(function() { $create....
What is this for? Kind regards

5 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 16 Sep 2010, 11:58 AM
Hi David,

Your guess is right - script controls do not work properly when rendered with RenderControl(), because the scripts and styles are not loaded on page. Normally, the control would load these resources automatically through the resource handlers (either ScriptResource.axd or WebResource.axd). When rendering with RenderControl(), however, you need to load these resources yourself. Here are two help topics that explain how to do that:

Disabling embedded resources and loading scripts manually

Manual skin registration

Veli
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
David Ahlbaum
Top achievements
Rank 2
answered on 16 Sep 2010, 07:33 PM
Thanks for the reply Veli. I think I´m halfway there...Right now I´m trying to ajax load a colorpicker. I´ve added scripts and css like:
  <link href="../Skins/Default/ColorPicker.Default.css" rel="stylesheet" type="text/css" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.PopupScripts.js"  />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryPlugins.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.ColorPicker.RadColorPicker.js" />

So now the colorpicker works when EnableEmbeddedScripts="false" and EnableEmbeddedSkins="false".
However it still doesn´t work when I ajax load, when I click it nothing happens (it looks fine though). I´m guessing there´s some initialization or something needed. I can see addHandler code in the colorpicker javascript file but I´m not sure how to call it. Any help is highly appreciated, I´m on a deadline...

Kind regards
David

0
Accepted
Veli
Telerik team
answered on 17 Sep 2010, 01:31 PM
Hi David,

If you set RegisterWithScriptManager="false" for the rendered RadControl, it should automatically register both its styles and scripts. Using this property, I was able to render a color picker on page without any externally registered styles or scripts, actually. Attaching the test page I used.

Regards,
Veli
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
David Ahlbaum
Top achievements
Rank 2
answered on 17 Jan 2011, 09:37 AM
This works but I have a related issue. When I set properties of my controls in the page behind they don't stick. For example if I do Language="sv-SE" in the markup the editor appears in swedish but if I do radEditor.Language="sv-SE" in the Page_Load of the user control it appears in default english. Is there a work around? When should I set the properties? and how? Any help appreciated
0
Veli
Telerik team
answered on 17 Jan 2011, 09:46 AM
You may need to set it earlier than that. Try it in Page_PreInit.

Veli
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.
Tags
General Discussions
Asked by
David Ahlbaum
Top achievements
Rank 2
Answers by
Veli
Telerik team
David Ahlbaum
Top achievements
Rank 2
Share this question
or