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

Default to HTML EditMode

5 Answers 260 Views
Editor
This is a migrated thread and some comments may be shown as answers.
fightclub777
Top achievements
Rank 1
fightclub777 asked on 15 Nov 2007, 06:38 PM
Is it possible to open the editor in the HTML edit mode, but still retain the option to switch to the other edit modes?  Thank you.

5 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 16 Nov 2007, 08:51 AM
Hi fightclub777,

You can achieve this with the following code:

 <telerik:radeditor runat="server" id="RadEditor1" onclientload="OnClientLoaded"></telerik:radeditor>

        <script type="text/javascript">
        function OnClientLoaded(sender, args)
        {
            sender.set_Mode(Telerik.Web.UI.EditModes.
Html);
        }
        </script>


where you have the following new enumeration:

Telerik.Web.UI.EditModes.prototype =
{
Design : 1,
Html : 2,
Preview : 4,
All : 7
};

Let me know if you have any other questions.


Sincerely yours,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Gompje
Top achievements
Rank 1
answered on 03 Jan 2008, 04:52 PM
is this possible in the code behind, when creating the editor dynamicly?
(eg. without javascript)


0
Rumen
Telerik team
answered on 03 Jan 2008, 05:11 PM
Hello Gompje,

Here is how to implement this feature on the server:

    protected void Page_Load(object sender, EventArgs e)
    {
        RadEditor editor = new RadEditor();
        form1.Controls.Add(editor);

        editor.OnClientLoad = "OnClientLoad";
        string js = @"
        <script type='text/javascript'>
        function OnClientLoad(sender, args)
        {
            sender.set_Mode(Telerik.Web.UI.EditModes.Html);
        }
        </script>";
       
        ClientScript.RegisterStartupScript(this.GetType(), "myscriptkey", js);
    }

You can find attached my test page and its codebehind.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Frank
Top achievements
Rank 1
answered on 19 Nov 2008, 06:33 PM
Hi, All:

       I use RadControls_for_ASP.NET_AJAX_2008_3_1105.  This example code seem didn't work, so how to set default to HTML editmode on my version ?
       Any advice and suggestion? Thanks a lot.
1
Rumen
Telerik team
answered on 20 Nov 2008, 04:42 PM
Hi Frank ,

All you need to do is to change the set_Mode method name with set_mode (lower-case m), e.g.

        RadEditor editor = new RadEditor();
        form1.Controls.Add(editor);

        editor.OnClientLoad = "OnClientLoad";
        string js = @"
        <script type='text/javascript'>
        function OnClientLoad(sender, args)
        {
            sender.set_mode(Telerik.Web.UI.EditModes.Html);
        }
        </script>";

        ClientScript.RegisterStartupScript(this.GetType(), "myscriptkey", js);

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
fightclub777
Top achievements
Rank 1
Answers by
Petya
Telerik team
Gompje
Top achievements
Rank 1
Rumen
Telerik team
Frank
Top achievements
Rank 1
Share this question
or