Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
935
getText method returns null string
posted

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.

Thanks
Michael