Javascript Not Registering in Ajaxified Grid

4 posts, 0 answers
  1. Oran
    Oran avatar
    6 posts
    Member since:
    Aug 2010

    Posted 20 Jan 2011 Link to this post

    Hi,

    I have a RadGrid with a template column that uses a user control in the Edit Template. The user control tries to Register a script to run that has a function in it that will be called when the user clicks on the user control. However the function is not properly registered and cannot be called by the user control.

    If I remove the RadGrid from the RadAjaxManager everything works fine.

    Here is a link to a sample project (zipped) that demonstrates my problem: sample project.

    I have looked around on the forums and tried some of the other suggestions to no avail.

    Can you please suggest a workaround for this?

    Thanks,
    Oran
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 20 Jan 2011 Link to this post

    Hello Oran,

    I would suggest you to use the ResponseScripts property of the RadAjaxPanel or RadAjaxManager. Please refer to the following help topic for more information on this matter.

    Regards,
    Maria Ilieva
    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.
  3. Oran
    Oran avatar
    6 posts
    Member since:
    Aug 2010

    Posted 21 Jan 2011 Link to this post

    Hi Maria,

    Thanks for the response.

    I can't use the ResponseScripts in my scenario since that is meant to execute a line a of JS as soon as the Ajax request completes. I want to add a JS function to the page that will be executed later when the user clicks on the user control. See the sample project attached.

    Thanks,
    Oran
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 26 Jan 2011 Link to this post

    Hello Oran,


    I revise the provided example and was able to replicate the described issue. The reason for the problem you are facing is caused by the fact that after Ajax request each script should be register by the Page, otherwise the ScriptManager will be register them properly. Please modify your script registration to:

    ScriptManager.RegisterStartupScript(Page, Page.GetType(), uniqeKey, script, true);

     

    Regards,
    Maria Ilieva
    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.
Back to Top