Using ScriptManager and StyleSheetManager with Dynamically-generated JS/CSS Content

4 posts, 0 answers
  1. Kevin Warnke
    Kevin Warnke avatar
    35 posts
    Member since:
    Feb 2010

    Posted 19 Oct 2011 Link to this post

    I'm using the ScriptManager and StyleSheetManager controls to combine multiple JS and CSS files into 1 request.  That all works as expected when the JS and CSS files are static content files bundled with the deployment.

    However, I would like to start using the same technique to include dynamic JS and CSS content that is generated by the server.  Think of it like including an ASPX page as one of the StyleSheetReference objects (although I tried this and it doesn't work by default).

    Does anyone know how to do this?

    Thanks,
    Kevin
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 24 Oct 2011 Link to this post

    Hello Kevin,

    RadScriptManager and RadStyleSheetManager are only able to serve embedded and external web resources (which are both static).

    I guess if you are dynamically generating, let say CSS, you can directly render it on the page, so there will not be an additional request. I hope this makes sense.

    All the best,
    Simon
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin Warnke
    Kevin Warnke avatar
    35 posts
    Member since:
    Feb 2010

    Posted 24 Oct 2011 Link to this post

    That does make sense and is one option.

    The CSS/JS does not change from request to request, though.  It would be the same so having it in an externally referenced file that gets cached between requests is the most ideal.

    So it sounds like these controls don't have a way to add script/CSS content versus an external (static) file reference that all gets combined.  Is that correct?

    Thanks,
    Kevin
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 27 Oct 2011 Link to this post

    Hello Kevin,

    Yes, that is correct - the controls can serve only embedded or external (files in the project structure) script and CSS files.

    Kind regards,
    Simon
    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