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

Make checkbox un-movable in Design mode

1 Answer 42 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Sameer
Top achievements
Rank 1
Sameer asked on 03 May 2013, 09:53 PM
Hello,

We use RadEditors to support drag and drop of pre-configured HTML that contains combination of text and few HTML controls like checkboxes and Dropdown lists. The Radeditor has to be in design mode as the user should be able to change/add any text even after the pre-configured text is dragged in. However, this creates an issue when checking/unchecking of checkboxes or even selecting values from drop down list. Users have to click multiple times to be able to select a value.

Is it possible to make the HTML controls not moveable/selectable in design mode so it would be easy to check/uncheck or select a value?

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 08 May 2013, 12:17 PM
Hello,

You can use the RadEditor's OnClientLoad event to get the HTML controls within the content area and add them attributes e.g. unselectable="on" and/or attach events handlers. Here is a sample code:
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad"></telerik:RadEditor>
 
<script type="text/javascript">
    function OnClientLoad(editor, args)
    {
        var checkboxes = $telerik.$('input[type=checkbox]', editor.get_contentArea());
        checkboxes.attr('unselectable', 'on');
 
        checkboxes.off('mousedown.RadEditorCustomMousedown');
        checkboxes.on('mousedown.RadEditorCustomMousedown', function(event)
        {
            if (editor.get_mode() == Telerik.Web.UI.EditModes.Design)
            {
                var checkbox = event.target;
                // check or unckeck the checkbox here
            }
        });
    }
</script>

I hope this will help you to achieve the required functionality.

Best regards,
Nikolay
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
Editor
Asked by
Sameer
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or