This is a migrated thread and some comments may be shown as answers.

custom tools xml and postback

3 Answers 60 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 15 Mar 2011, 11:53 PM

hi,

I am loading a custom ToolsFile.xml into Radeditor with

 

 

"LoadToolsFile(dom)"

 

 

.
after a postback some tools like colorselection do no longer work, because
of a javascript error in the Editor script.
now i found out that reloading the tools-xml file on every request fixes the issue, but in my
understanding, the editor should be recreated from viewstate after postback?

 


regards,
peter

 

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 18 Mar 2011, 11:07 AM
Hi Peter,

If you are creating tools dynamically and have enabled ViewState the tools will be added again after every postback. You can observe this behavior in the attached page. If you disable ViewState you will no longer have such an issue. This is why the tools are not usually saved to the ViewState and should be reloaded every time. The best way to do it is the ToolsFile property of the Editor.

The LoadToolsFile() method is deprecated in favor of the ToolsFile property. Even if you are creating the ToolsFile.xml file dynamically you should use the ToolsFile property to load it in the editor afterwards. Depending on your scenario you may also need the EnsureToolsFileLoaded() method.


Regards,
Marin
the Telerik team
0
Peter
Top achievements
Rank 1
answered on 18 Mar 2011, 11:51 AM
hi marin,
thank you.
how can i use a dynamically createt tools xml with the toolsfile property? there would be need to write the xml to a temporary file and  which is not really a good solution.  so the  LoadToolsFile(XmlDocument) function should not be deprecated.

regards,
peter
0
Marin Bratanov
Telerik team
answered on 21 Mar 2011, 01:49 PM
Hi Peter,

If you do not want to use a static file you can keep using the LoadToolsFile(XmlDocument) method. Just note that, as I explained before, you shouldn't rely on the ViewState for saving the tools and you should load your custom ToolsFile on every postback.
Consider the overhead of creating this file dynamically every time versus having a static file in the file system and choose depending on your current scenario. I would also recommend considering the maintainability of both solutions.


Best wishes,
Marin
the Telerik team
Tags
Editor
Asked by
Peter
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Peter
Top achievements
Rank 1
Share this question
or