This problem is a bit tricky to explain, I'll try to make myself clear...
I have a custom list which includes different field types including a Rich Text field and a custom field type called Hierarchical Lookup Field. This custom field is basically a treeview, the custom control includes an UpdatePanel to refresh the treeview using ajax calls when user clicks on a tree node.
I have a custom web part to show an edit form for this custom list, so fields are added in the CreateChildControls method of the web part.
The problem I have is the following: when the user clicks on the treeview, the Rich Text field also present in the edit form is duplicated. Each AJAX call makes the Rich text field to be duplicated...
While analyzing the request/response of the AJAX calls I noticed that the response includes the following JS function: RTE_ConvertTextAreaToRichEdit which is OOTB function to handle the Rich Text field rendering based on the browser type & version.
I tried to reproduce the problem using the OOTB edit form from the list directly and I couldn't.
So I also anlayzed the request/response of the AJAX calls while using the OOTB edit form from the list. And I didn't see that RTE_ConvertTextAreaToRichEdit function in the response.
Using the debugger I skipped the excution of this function on ajax calls on my custom edit form and the problem was fixed.
So my problem basically is to understand why the ajax response includes this JS function. But I couldn't find any reason so far. This function is obviously included on the page because there is a Rich Text field added on the form but the script is clearly outside the Update Panel so I don't see why the response includes this script which has been executed already on the initial page load.
Any idea why is this happening?