Hi,
I'm using Infragistics 12.1 jQuery controls and cannot for the life of me set the value of a igHtmlEditor. The Infragistics documentation is poor at best as I've worked with 4 or 5 jQuery 12.1 controls and next to nothing works as expected (in terms of the API). For example, your samples/examples say to use $(element).igDatePicker("value") to get the value of a date picker when actually, you have to use $(element).igEditor("value"). What gives? I've had to hit up the forums or google to figure out how to use each one of those jQuery controls because the documentation is incorrect!
Now that I've vented a little, let me get to the problem at hand. I've tried setting the Value on the HtmlEditorModel which does not work. I tried setting the value in javascript using $(element).igHtmlEditor("setContent", "<p>this is my content</p>", "html"); which also does not work. Furthermore, when I use the latter method, the control fails to render. I can see that there is a new ig.loader script added to the page with my content specified, but the HtmlEditor is no where to be found.
How can I set the value? I would prefer to define it at the same I define the control (ASPX/MVC Helper Method). However, with the ASPX method for adding a control, I have to use Html.Infragistics().HtmlEditor("myID", myHtmlEditorModel) which doesn't allow you add Value() to the chain. Sigh.
Please help.
Hello abromfield,
You are correct, the “igHtmlEditor” was recently added to our toolset and that is why resources for it are not easy to find.
Regarding your question - I can recommend you to use “setContent” method if you want to set some initial text or add text dynamically to the editor.
Sample showing text insertion with “setContent” can be viewed and tested here - http://es.infragistics.com/products/jquery/sample/html-editor/manipulating-text
If you need additional assistance let me know.
Sorry, I forgot I had mentioned that I already tried the method you suggested (see the second paragraph of my original post). When I try to populate it using that method, the IgHtmlEditor fails to render on the page at all. Now I don't know if that is because I have two IgHtmlEditors on the same page but it shouldnt be. A more likely cause is that when using the "setContent" method, $.ig.loader() or whatever call is added to the dom, which could be clashing with the loader script (ASP.NET/MVC Helper method) that i have in the head of my MasterPage.
Any ideas?
Thank you very much Alex, I'll give your suggestion a go.