I've made a Silverlight HtmlEditor control that inherits from RadHtmlPlaceHolder. This loads an editor.aspx page that uses the ajax RadEditor. When that page loads, it makes a call back to the siliverlight host HtmlEditor control to get the html to edit. When I save from my silverlight app, the HtmlEditor control makes a call to that page to get updated html.
I was using the following code to get the html FROM the page
However, I was having an odd issue. The first time I editted some content, it would work. Then after, every other time I tried to edit content, while the correct content would appear in the editor, the changes actually saved (that is the html returned from the page) was always the same text as the very first time I had editted.
I made a change to the above code to always uniquely name the frame
and now I'm always getting back the correct updated hml.
This makes it seem like everytime I open a new window with a RadHtmlPlaceHolder control, that even after I close that window, that something is getting cached or not cleaned up.
Any ideas?
I was using the following code to get the html FROM the page
HtmlElement iframe = (HtmlElement)this.HtmlPresenter.Children[0]; |
// Set an ID to the IFrame so that can be used later when calling the javascript |
iframe.SetAttribute("id", "myIFrame"); |
string code = "document.getElementById('myIFrame').contentWindow.GetEditor().get_html();"; |
string html = (string)HtmlPage.Window.Eval(code); |
However, I was having an odd issue. The first time I editted some content, it would work. Then after, every other time I tried to edit content, while the correct content would appear in the editor, the changes actually saved (that is the html returned from the page) was always the same text as the very first time I had editted.
I made a change to the above code to always uniquely name the frame
string guid=Guid.NewGuid().ToString().Replace("-",""); |
HtmlElement iframe = (HtmlElement)this.HtmlPresenter.Children[0]; |
// Set an ID to the IFrame so that can be used later when calling the javascript |
iframe.SetAttribute("id", guid); |
string code = "document.getElementById('"+guid+"').contentWindow.GetEditor().get_html();"; |
string html = (string)HtmlPage.Window.Eval(code); |
and now I'm always getting back the correct updated hml.
This makes it seem like everytime I open a new window with a RadHtmlPlaceHolder control, that even after I close that window, that something is getting cached or not cleaned up.
Any ideas?