Enabled = false Problem

6 posts, 0 answers
  1. Bader
    Bader avatar
    215 posts
    Member since:
    Aug 2008

    Posted 02 Aug 2011 Link to this post

    Hello,

    I'm using the following RadEditor within the usercontrol of the Insert/Update/Delete RadGrid:
    <telerik:RadEditor runat="server" ID="CntntRadEditor" Enabled="false" Height="500px" Width="100%" style="z-index:1000;" Content='<%# DataBinder.Eval( Container, "DataItem.Cntnt") %>' ToolsFile="~/Common/Controls/RadEditor/xml/CustomFullSetOfToolsForSecureTables.xml">
                                <Modules>
                                    <telerik:EditorModule Visible="false" />
                                </Modules>
                                <ImageManager ViewPaths="~/Guide/Design/Contents" UploadPaths="~/Guide/Design/Contents" DeletePaths="~/Guide/Design/Contents" />
                                <DocumentManager ViewPaths="~/Guide/Design/Contents" UploadPaths="~/Guide/Design/Contents" DeletePaths="~/Guide/Design/Contents" SearchPatterns="*.doc,*.txt,*.docx,*.xls,*.xlsx,*.pdf,*.xml" />
                            </telerik:RadEditor>

    The problem is that the RadEditor control is hidden by seeting the property Enabled=false.
    If I remove that property, the RadEditor is displayed normally.
    The requirements is to disable the RadEditor control in order to prevent the user from typing a text and from clicking any icon from the RadEditor toolbar.

    Please, I need your help,
    It is appreciated to send me the modified code.

    Regards,
    Bader
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Aug 2011 Link to this post

    Hello Bader,

    You can try the following javascript to enable and disable RadEditor using a ButtonClick.
    JS:
    <script type="text/javascript">
    var toggle = true;
    function toggleEditing()
    {
        var editor = $find("<%=RadEditor1.ClientID%>");
        toggle = !toggle;
        editor.enableEditing(toggle);
        editor.set_editable(toggle);
        if (toggle == false) editor.get_document().body.style.backgroundColor = "gray";
        else editor.get_document().body.style.backgroundColor = "";
    }
    </script>
    aspx:
    <telerik:RadEditor ID="RadEditor1" runat="server">
     . . . .
    </telerik:RadEditor>
     <input type="button" onclick="toggleEditing();return false;" value="Toggle editing" />

    Thanks,
    Shinu.
  3. Bader
    Bader avatar
    215 posts
    Member since:
    Aug 2008

    Posted 03 Aug 2011 Link to this post

    Hello,

    Thank you for your reply,
    Your solution doesn't meet the requirements.
    Please look at the demo http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx (Both RadEditor and The following RadComboBox are placed within the usercontrol).

    I need to enable and disable the RadEditor control based on the selected value of a RadComboBox:
    <telerik:RadComboBox ID="TypeRadComboBox" SelectedValue='<%# DataBinder.Eval( Container, "DataItem.Type" ).ToString().Trim() %>' runat="server" AutoPostBack="true" OnSelectedIndexChanged="TypeRadComboBox_SelectedIndexChanged" Width="215px">
                            <Items>
                                <telerik:RadComboBoxItem runat="server" Text="Folder" Value="Folder" />
                                <telerik:RadComboBoxItem runat="server" Text="Document" Value="Document" />
                            </Items>
                            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                        </telerik:RadComboBox>
    protected void TypeRadComboBox_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
    RadComboBox combo = (RadComboBox)o;
    if(combo.SelectedValue.Equals("Folder"))
    CntntRadEditor.Enabled = false;
    else CntntRadEditor.Enabled = true;
    }

    The problrm is when I select the "Floder" value, then the radEditor get hidden

    Please, I need you help,
    It is appreciated to send me the modified code.

    Regards,
    Bader
  4. Steve
    Steve avatar
    1 posts
    Member since:
    Feb 2011

    Posted 29 Aug 2011 Link to this post

    Instead of disabling the editor, you can achieve the functionality you desire (visible, but non-functioning editor tool bars and "locked" text) by setting the editor's editmode to 'preview' mode, and then toggling the editmode back to 'design' mode to "re-enable" the editor.

    e.g.
    protected void TypeRadComboBox_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
    RadComboBox combo = (RadComboBox)o;
    if(combo.SelectedValue.Equals("Folder"))
    CntntRadEditor.EditMode = EditMode.Preview;
    else CntntRadEditor.EditMode = EditMode.Design;
    }

    I hope this helps.
  5. KOGAN
    KOGAN avatar
    4 posts
    Member since:
    Mar 2011

    Posted 21 Oct 2012 Link to this post

    Hi,

    I'm facing a similar issue when the RadEditor is placed within a Panel Control.
    By disabling (Enable=false) the Panel control, all controls that are inside it, are disabled too except to the RadEditor control.
    what I should do in this situation?

    Regards,
    Bader
  6. Rumen
    Admin
    Rumen avatar
    14459 posts

    Posted 24 Oct 2012 Link to this post

    Hi,

    You can put RadEditor in Preview mode as suggested before. The Enabled property of RadEditor set to false, renders a DIV element with the RadEditor's content in it. The RadEditor1.EditModes = EditMode.Design; renders the RadEditor in Preview mode and the editor is disabled.

    Regards,
    Rumen
    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