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

ajax loading user controls which contain Javascript

2 Answers 88 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Albert Shenker asked on 22 Dec 2011, 11:28 PM
It seems to me that 95% of the examples you have and code you supply contains client-side javascript. This is not surprising, of course, because Telerik has created a great and powerful client-side API for most of its controls. However, shouldn't the demo you provide at:

http://demos.telerik.com/aspnet-ajax/ajax/examples/common/loadingusercontrols/defaultvb.aspx

contain a BIG warning message telling developers that this functionlity won't work if your user controls contain javascript? Unless Telerik has come up with some sort of solution recently, it is my understanding that you can't load Usercontrols containing javascript with AJAX and expect the javascript to function properly (ie load along with the rest of the usercontrol).

2 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 23 Dec 2011, 09:37 AM
Hi Albert,

The issue you are describing is by no means constrained to RadControls suite and the RadAjax controls inside. The MS AJAX framework cannot identify javascript inside the asyncrhonously updated HTML content. Here is an external blog post on the topic. To work around this limitation, we have created the RadScriptBlock control. It takes the javacript inside and registers it properly with the ScriptManager, so that the javascript is evaluated after an AJAX request.

Veli
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
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 23 Dec 2011, 02:16 PM

I didn't mean to imply that the issue is constrained to Telerik RadControls. It appears to be a limitation of the Ajax framework. Ok, that doesn't mean your examples shouldn't have warnings associated with them to prevent developers from wasting time.

Anyhow, I have seen the suggested use of scriptblocks and I have found them not to work. I am unable to attach a project to this forum post, so I have opened a ticket.

Tags
Ajax
Asked by
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Answers by
Veli
Telerik team
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Share this question
or