ajax loading user controls which contain Javascript

3 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    579 posts
    Member since:
    Mar 2004

    Posted 22 Dec 2011 Link to this post

    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. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 23 Dec 2011 Link to this post

    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
  3. Albert Shenker
    Albert Shenker avatar
    579 posts
    Member since:
    Mar 2004

    Posted 23 Dec 2011 Link to this post

    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.

Back to Top