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

Referencing client-side event handlers for a user control

1 Answer 118 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 12 Dec 2011, 03:14 PM

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.

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 14 Dec 2011, 06:37 PM
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
Tags
TreeList
Asked by
Paul
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or