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

How to find all editors inside a panel on client side and attach an event handler for user interaction?

1 Answer 129 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Tigger Tag
Top achievements
Rank 1
Tigger Tag asked on 08 Apr 2016, 09:12 PM

Hi,

 

I have two questions.

1. I need to have a client side event handler be called whenever user interacts with any of the RadEditors that exist on the page. What event I need to use?

2. Also, I can't change the markup or the code behind to add this event handler. So, how will I find all RadEditors on the page and attach this event using javascript?

 

Any help is greatly appreciated.

 

Thanks,

Ana

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 13 Apr 2016, 10:29 AM
Hi Ana,

You can use the code below to get all the editors on the page.  You can also attach client-side handlers with JavaScript - http://docs.telerik.com/devtools/aspnet-ajax/controls/editor/client-side-programming/events/overview

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
    <telerik:RadEditor ID="RadEditor1" runat="server"></telerik:RadEditor>
    <telerik:RadEditor ID="RadEditor2" runat="server"></telerik:RadEditor>
    <telerik:RadButton ID="RadButton1" runat="server" />
    <script>
        function pageLoad() {
            var radControls = $telerik.radControls;
            var editors = new Array();
            alert('number of ui controls: ' + radControls.length);
            for (var i = 0; i < radControls.length; i++) {
                var currControl = radControls[i];
                if (currControl && (currControl instanceof Telerik.Web.UI.RadEditor)) {
                    editors.push(currControl);
                }
            }
            alert('number of editors: ' + editors.length);
        }
    </script>
</form>


Regards,
Danail Vasilev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Jacki Jenuth
Top achievements
Rank 1
commented on 25 Nov 2023, 06:55 PM

Thank you Danail. The workaround is working as expected. 
Rumen
Telerik team
commented on 26 Nov 2023, 01:02 PM

Tags
Editor
Asked by
Tigger Tag
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or