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

[Solved] Using HttpHandler for tools xml and css

1 Answer 141 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 07 Nov 2009, 04:27 PM
I need to save the tools xml and css classes for the RadEditor in a database and the apply them to the editor based on which user is viewing.  I'm trying to use an HttpHandler to render the xml and css as follows:
                           
                            if (type == "tools"
                            { 
                                context.Response.Clear(); 
                                context.Response.ContentType = "text/xml"
                                context.Response.Write(toolsXml); 
                            } 
                            else if (type == "css"
                            { 
                                context.Response.Clear(); 
                                context.Response.ContentType = "text/css"
                                context.Response.Write(cssText); 
                            } 

In the above code, "toolsXml" and "cssText" are strings that contain the text from the database. 

Then code the editor as follows:

editor.ToolsFile = "~/ResourceHandler.ashx?mode=editor&type=tools";
editor.CssFiles.Add("~/ResourceHandler.ashx?mode=editor&type=css");

The editor throws an error when setting the ToolsFile property in this way, and just doesn't apply the css file at all.  How can I make the editor accept the handler as a valid xml or css url?

Thanks,
Matt



1 Answer, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 11 Nov 2009, 01:39 PM
Hi Matt,

To load the ToolsFile via a http handler you should use a full URL which starts with http://
Another way to load the toolsfile is using the LoadToolsFile server method of RadEditor which receive XML document as a value containing the different tools.

The Css files could be loaded with ~/ path. Our suggestion is to delete your browser cache and test again.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
Matthew
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or