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

[Solved] Stylesheet added in jQueryViewComponentBase never rendered

2 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Niels Schneider
Top achievements
Rank 1
Niels Schneider asked on 19 Aug 2009, 06:51 AM
Hi,

In de jQueryViewComponentBase class the jQuery stylesheet is added to the list StyleSheetNames. The render method of the StyleSheetRegistrar will use this list among others, to render alle the LINK tags in the HTML. The problem is this will only work when the stylesheet links are rendered _after_ the components are processed. While it is possible to render the component level stylesheets at the bottom of the page, it is impossible to render them in the HEAD section!

The example is solving this problem by declaring the jQuery stylesheet in the masterpage. Is there a way to get this auto registration mechanisme for components working and render the LINKs into the HEAD section?

Thanks,

Niels

2 Answers, 1 is accepted

Sort by
0
Niels Schneider
Top achievements
Rank 1
answered on 20 Aug 2009, 08:23 AM
Found a solution in a post from Hugo Bonacci (http://somewebguy.wordpress.com/2009/07/28/include-stylesheets-and-scripts-from-a-webcontrol-in-mvc/). I made some additional code in the StyleSheetRegistrar and its builder for inserting a marker where the stylesheets must be rendered. The new StyleSheetLocationMarkerFilter class handles the insertion by delaying writing to the request output stream as described in Hugo's post. As MVC views normally aren't that large (?) the delay will not bring your response times down to an unacceptable level.

I'm happy to donate it to the project. Kazi can I mail it to somebody at Telerik to have a look at it and possibly add it to the project?

0
Accepted
Kazi Manzur Rashid
Telerik team
answered on 20 Aug 2009, 02:33 PM
Hi Niels Schneider,

Yes you are absolultly correct, It is an known issue that we planned to fix in the final release and I think It needs to be solved with the Response Filter that you mentoned (though there is some performance overhead with this approach), sure you can send me the code at rashid@telerik.com.
 
Kind regards,
Kazi Manzur Rashid
The Telerik Team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Niels Schneider
Top achievements
Rank 1
Answers by
Niels Schneider
Top achievements
Rank 1
Kazi Manzur Rashid
Telerik team
Share this question
or