Referencing client-side event handlers for a user control

2 posts, 0 answers
  1. Paul
    Paul avatar
    34 posts
    Member since:
    Aug 2011

    Posted 12 Dec 2011 Link to this post

    We have wrapped the .Net TreeList control for our application. Once the ASP page is loaded and starts execution, we get on error stating that the ClientSettings.ClientEvents handlers are undefined. We have tried declaring the event handlers in the TreeList declaration of the TreeList in the .ascx file and setting the event handlers at run time in the .ascx.vb file.

    We tried registering the client scripts which I don’t like having to place an entire function in a string. We have placed the reference function in the .ascx file and in a separate file which is then included in the outer .aspx file.

    We have just upgraded to the latest version last week. I’m not sure what version. From Visual Studio, the Telerik About menu doesn’t display version information, just an advertisement.


    What is the proper method of creating a user control with client side event handlers? We found several similar questions posted, but none of the answers appear to work for this version.

  2. Antonio Stoilkov
    Antonio Stoilkov avatar
    530 posts

    Posted 14 Dec 2011 Link to this post

    Hi Paul,

    You could try one of the following methods to overcome the issue:
    • Wrap the script tag in the user control in RadScriptBlock
    • Register the script on page load using ScriptManager as it is shown in the example below
    ScriptManager.RegisterStartupScript(Page, typeof(Page), "WebUserControlScripts",
                "function BtnClick(){alert('clicked');}", true);

    For more information on RadScriptBlock you could go through the help article below:

    Kind regards,
    Antonio Stoilkov
    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
Back to Top