Relative path for external CSS file problem

2 posts, 0 answers
  1. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 19 Apr 2012 Link to this post

    Hello

    I have a radEditor for which I need to provide relative paths for its various CSS files.

    For example:

    <CssFiles>
      <trk:EditorCssFile Value="stylesheets/EditorContentArea.css" />
    </CssFiles>

    where the 'stylesheets' folder would be a subfolder in the same folder as the markup and code files.

    But the relative path doesn't work, whereas using an absolute path is successful, e.g., this path does find the CSS file in question:

    <CssFiles>
      <trk:EditorCssFile Value="~/[path_to_my_stylesheets]/EditorContentArea.css"

    </CssFiles>

    What could be occurring here? Is the a behaviour that can be configured and changed somehow to enable the use of a relative path. Possibly at the time of processing, the relative path is being determined from a different location to that of the markup file?

    If anyone can point me in the right direction it would be very greatly appreciated!

    Regards

     

  2. Rumen
    Admin
    Rumen avatar
    14351 posts

    Posted 21 Apr 2012 Link to this post

    Hello,

    The CssFiles property expects a virtual path which points to the root of the web application under which RadEditor resides. This means that the path should starts with ~/ .

    What you can do is to put the CSS file(s) in some folder outside of the web application and make it using IIS a virtual folder pointing to the root of the web application.

    All the best,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top