I have a WebHtmlEditor control inside a user control that i dynamically create when the user clicks a button on my page. The newly created WebHtmlEditor control does not produce the "Modify Image" popup when i click the "Insert Image" button, but sends back the same page as what the user control is contained in.
Any suggestions on what i need to be looking at? We are using 7.1.20071.1048
Thanks
Hi,
Unfortunately any "upload" functionality is supported by WebHtmlEditor only if it is created on the very first Load of page (without any conditions like IsPostBack). Otherwise, the async request used by editor is not able to identify its owner and server responds with its default html.
I wrapped a WebHtmlEditor inside a custom class vb representing a control. This control is create (and re-create) in the Page_init event in every postback (i'm not using ispostback condition) and the insert image funtionality doesn't work, it gives me the default html, instead of show the insert image modal. Any ideas?
PD: the uploadDirectory is set correctly and I using v 10.3
Thanks!
I'm trying the same code in the Page_OnInit event but inside a UpdatePanel and the images popup doesn't work, i'm missing something else?
I tried following and upload functionality of WebHtmlEditor worked without problems.
aspx:
<form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Button ID="Button1" runat="server" Text="InsideUpdatePanel" /> </ContentTemplate> </asp:UpdatePanel></form>
aspx.cs:
public partial class HtmlEditorDynamic : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected override void OnInit(EventArgs e) { Infragistics.WebUI.WebHtmlEditor.WebHtmlEditor editor = new Infragistics.WebUI.WebHtmlEditor.WebHtmlEditor(); editor.ID = "WebHtmlEditor1"; editor.UploadedFilesDirectory = "./upload"; this.UpdatePanel1.ContentTemplateContainer.Controls.Add(editor); base.OnInit(e); }}
Thanks for the response!
I was missing the fact that the insert image option make a postback to the current page but the querystring is not in the format correct.
It's there a way to know that this postback is make by the image button and get the querystring from the parent?
Thanks again!
WebHtmlEditor uses global function iged_modal when it sends request to server to generate dialog with upload information (image, media, etc). So, in theory application may hack into that method on client and do adjustments, modify url, etc. However, if WebHtmlEditor is not created consistantly on server, then those fixes on client hardly may improve anything. You may insert following at the end of <form> or <body> in your aspx where editor is created and track async postbacks:
<script type="text/javascript"> if(!window._oldModal) { window._oldModal = window.iged_modal; if(!window._oldModal) alert('no js files of WebHtmlEditor loaded'); else window.iged_modal = function(url, height, width, evt) { alert('before upload: ' + url); window._oldModal(url, height, width, evt); } }</script>