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

Stripping script tags

7 Answers 64 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 28 Oct 2008, 04:10 PM
Hi
Is there a method for stripping out any 'script' tags after the submit button has been pressed?

Thanks
Matt

7 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 28 Oct 2008, 04:14 PM
Hi Matt,

The RemoveScripts client filter of RadEditor strips all script tags on submit or when switching to Html mode. It is enabled by default. If it is disabled on your side, you can enable it with

C#:

RadEditor1.EnableFilter(Telerik.Web.UI.EditorFilters.RemoveScripts);

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matt
Top achievements
Rank 1
answered on 28 Oct 2008, 04:23 PM
Hi

The filter works when switching between HTML mode and design mode, however, if you just create a script in HTML mode and click the submit button the 'script' tags don't seem to get removed.

I have this in my code: -

RadEditor1.EnableFilter(EditorFilters.RemoveScripts)

Thanks
Matt

0
Rumen
Telerik team
answered on 28 Oct 2008, 04:38 PM
Hi Matt,

My suggestion is to programmatically switch to Design mode before submitting the content. Here is an example:

    <telerik:RadEditor ID="RadEditor1" runat="server">
        <asp:Button ID="Button1" runat="server" OnClientClick="SwitchEditor()" Text="Button" OnClick="Button1_Click" />
        <asp:TextBox ID="TextBox1" runat="server" Height="127px" TextMode="MultiLine"></asp:TextBox>
        <script type="text/javascript">
        function SwitchEditor()
        {
            var editor = $find("RadEditor1");
            editor.set_mode(1); //switch to Design mode
        }
        </script>

Codebehind:

    protected void Button1_Click(object sender, EventArgs e)
    {
        TextBox1.Text = RadEditor1.Content;
    }

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matt
Top achievements
Rank 1
answered on 28 Oct 2008, 04:42 PM
Thanks Rumen, that works fine, is there a way of making the HTML view button not appear at all?
0
Tervel
Telerik team
answered on 29 Oct 2008, 06:56 AM
Hello Matt,

Hiding the HTML mode is even easier and can be set with a property.
The following online demo demonstrates that:
http://demos.telerik.com/aspnet/prometheus/Editor/Examples/EditModes/DefaultCS.aspx

The property is EditModes ="Design,Preview"

Best wishes,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Patrice Boissonneault
Top achievements
Rank 2
answered on 11 Apr 2011, 06:20 PM
Is it possible to do the same with a textbox multiline?
0
Rumen
Telerik team
answered on 14 Apr 2011, 12:33 PM
Hi Patrice,

Could you please explain what do you want to achieve? What do you mean by a multi-line textbox? Do you mean RadTextBox, a mult-iline Asp:TextBox or another control?

Kind regards,
Rumen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Editor
Asked by
Matt
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Matt
Top achievements
Rank 1
Tervel
Telerik team
Patrice Boissonneault
Top achievements
Rank 2
Share this question
or