locked
Using embedded resource with HTMLEditor RRS feed

  • Question

  • User-1847440639 posted

    I have a custom control that dynamically creates an HTMLEditor. I want to set DocumentCssPath using an embedded resource file. The natural way would be

    editor.DocumentCssPath = Page.ClientScript.GetWebResourceUrl(GetType(), "HTMLEditor.Document.css")

    This doesn't work, because of how the editor is implemented. The editor checks checks whether the given path exists as a physical file, and otherwise uses its own stylesheet. The URL returned by GetWebResourceUrl() is something like WebResource.axd?d=abc123, which is not a physical file, so the editor ignores my DocumentCssPath. Is there a way to work around this?

    The main solution I've considered is to inject the stylesheet manually (using Javascript) into the iframe rendered by Editor. I'd prefer a nicer solution.

    Wednesday, November 6, 2013 11:20 AM

Answers

  • User-1847440639 posted

    I want to set DocumentCssPath using an embedded resource file.

    I decided to keep the .css file as a "physical" file instead of as an embedded resource. Getting it to work with embedded resources seems more complicated than what it's worth at the moment. Some of the suggested links mention setting the CssClass property, but that only affects the chrome, and not the style inside the text editor.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 12, 2013 8:10 AM

All replies

  • User-417640953 posted

    Hi Mordrey,

    HTMLEditor is an ASP.NET AJAX Control that allows you to easily create and edit HTML content. It has a default style which is embedded

    as a WebResource and is a part of the Toolkit assembly that has styles set for all the sub-classes. You can see generated HTML markup and preview document. 

    From your description, I see that you want to use your own custom css style to the HTMLEditor. The solution you mentioned is

    a practicable solution. You can change the look and feel of HTMLEditor using the HTMLEditor CssClass property. 

    Please check below link to get the css classes of HTMLEditor .

    http://www.asp.net/ajaxlibrary/act_HTMLEditor.ashx

     

    Hope this helps. Thanks.

    Best Regards!

    Thursday, November 7, 2013 9:46 PM
  • User-1847440639 posted

    I want to set DocumentCssPath using an embedded resource file.

    I decided to keep the .css file as a "physical" file instead of as an embedded resource. Getting it to work with embedded resources seems more complicated than what it's worth at the moment. Some of the suggested links mention setting the CssClass property, but that only affects the chrome, and not the style inside the text editor.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 12, 2013 8:10 AM