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

RadEditor TextChanged Event temporarily disable?

1 Answer 64 Views
Editor
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 25 Jun 2010, 08:51 PM

I use the Telerik RadEditor to display editable documents selected from a RadList box.  I populate the editor programmatically (server side) as the user selects items from the list box.  The TextChanged event fires when ever the user modifies a document, that's good.  It also fires when the user selects a different list item (radeditor is loaded programmatically via radeditor1.contents=), this is bad.

I'm wondering if there is some way to disable the TextChanged Event temporarily when the radeditor is populated programatically but retain the behavior that the TextChanged event fires if the user actually makes a change to the document in the radeditor.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 30 Jun 2010, 02:39 PM
Hi John,

The RadEditor for ASP.NET AJAX was intended to be as simple to configure as possible - and we decided to follow the familiar pattern of TextBox as this is in fact how the editor is used in almost all cases. The development paradigm is that the editor is a part of a larger page that has some other means of making a postback or a callback - and the editor should not interfere in it. Thus, the Submit and Cancel buttons were removed.

Since the new editor does not offer any more an Update button, it is not longer registered as a postback control and the OnTextChanged event is not implemented. You can use it only for backward compatibility to avoid server errors but this event does not do anything.

Our recommendation is to implement the desired functionality yourself by storing the content in some ViewState variable and on postback to compare the current content with the content saved in this variable. You can obtain the content on the client using the editor.get_html(true) method and check whether it is changed by attaching your code to the onkeydown event using the attachEventHandler method.

Please, note that there is not a reliable way to check whether the content is modified on the server because the content is validated and modified by the browser and the RadEditor's built-in content filters. For example if you load non well formed content in the editor then the editor and the browser will change it even without user interaction and when you save it the content will be different from the initial one.


All the best,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Editor
Asked by
John
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or