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

Help reseting the content of the editor in javascript

1 Answer 55 Views
Editor
This is a migrated thread and some comments may be shown as answers.
john
Top achievements
Rank 1
john asked on 22 Oct 2008, 10:33 PM
I have this line of code as I am trying to reset or clear the content of the editor in javascript.
I am new to javascript. The editor is inside an ajax updatepanel control that has the update set to 'conditional' and childrenastrigger set to 'false' if all this matters.

this is what I have and it always gives me an error:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

If Not Me.IsPostBack Then

 

 

 

Button1.Attributes.Add("onclick", "$find(" + RadEditor1.ClientID + ").set_html('');return false;")

 

 

End If

 

 

 

End Sub

 

 

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 23 Oct 2008, 02:44 PM
Hi John,

Here is the requested example:

ASPX page:

<telerik:RadEditor ID="RadEditor1" runat="server"></telerik:RadEditor>
<asp:Button ID="Button1" runat="server" Text="Button" />
<script type="text/javascript">
function Reset()
{
    $find("<%= RadEditor1.ClientID%>").set_html('');
}
</script>

Codebehind:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Button1.Attributes.Add("onclick", "Reset();return false;")
    End Sub

For your convenience I have attached my test files.

Kind regards,
Rumen
the Telerik team

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