I am currently using the WebHtmlEditor control in my web application project. v10.1 of the control. I have some JavaScript on the page that I use to store the current state of the input controls, if a change is made I am able to flag to the user that data hasn't been saved if they navigate away.
This code works for all of the input controls without fuss, but in the same method I have the following code;
if (_additionalControl) { alert(_additionalControl); var bodyControl = iged_getById(_additionalControl); if (bodyControl) { alert(bodyControl.getText()); initialValues[$(_additionalControl)] = bodyControl.getText(); }}
The alerts are in there for debugging. I store the client Id of the WebHtmlEditor control in _additionalControl, I use the iged_getById method to get the editor control and then call the getText method, which returns an empty string,
The code below is what sets the text to the WebHtmlEditor control; uxEmailTemplate.Text = emailTemplate.EmailTemplateBody
I then call a method on a control that performs the following code;ScriptManager.RegisterStartupScript(Page, [GetType](), "CleanPage", "saveInitialValue();", True)
The method saveInitialvalue() is has the above JavaScript code inside.
As I have said, I am able to get the text value of all the other controls at this point but not with the WebHtmlEditor Control.
Any suggestions on why this is happening or on how I can fix this would be appreciated.
ThanksMichael
I have managed to solve this.
I have included a hidden field on the page which is populated by the encoded version of the text from the control. Then when I perform the selection change, I will look that value up and compare it to the getText method.
An additional note on this. I can get the text successfully on the page after everything has rendered on the page.