4 posts, 0 answers
  1. Dustin
    Dustin avatar
    79 posts
    Member since:
    Oct 2012

    Posted 23 Nov 2010 Link to this post

    I started using the RadStyleSheetManager and realized that it is more of a pain to use then not use since there is no proxy version. So I created a custom StyleSheetManagerProxy control that can be used in combination with the RadStyleSheetManagerProxy similar to the RadScriptManager and ScriptManagerProxy.

    Imports System.ComponentModel
    Imports System.Web.UI
    Imports System.Web.UI.PersistenceModeAttribute

    Namespace CustomControls

        Public Class StyleSheetManagerProxy
            Inherits Control

    #Region "Events"

            Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
                Dim rssm As RadStyleSheetManager = RadStyleSheetManager.GetCurrent(Me.Page)
                If rssm IsNot Nothing Then Me.StyleSheets.ToList().ForEach(Sub(i) rssm.StyleSheets.Add(i))
            End Sub

    #End Region

    #Region "Properties"

            Private m_StyleSheets As StyleSheetReferenceCollection

            <DefaultValue(CType(Nothing, String))>
            Public ReadOnly Property StyleSheets As StyleSheetReferenceCollection
                    If m_StyleSheets Is Nothing Then m_StyleSheets = New StyleSheetReferenceCollection()
                    Return m_StyleSheets
                End Get
            End Property

    #End Region

        End Class

    End Namespace
  2. Simon
    Simon avatar
    2281 posts

    Posted 24 Nov 2010 Link to this post

    Hello Dustin,

    Thank you for sharing your thoughts about the StyleSheetManagerProxy class.

    Your implementation will suffice in cases one needs to add embedded style sheets in a Content page or a UserControl. The other would be to directly add the settings programmatically to the StyleSheetManager's StyleSheet collection.

    Currently we do not have plans for adding such a control to the suite, still we will reconsider your suggestion in the future.

    All the best,
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. Simon
    Simon avatar
    2 posts
    Member since:
    Mar 2011

    Posted 12 Apr 2012 Link to this post

    Thanks for this code, we've found it really useful, especially when declaritively referencing external style sheets from pages nested within multiple Masterpages.

    Pity that the Telerik library doesn't have this functionality built in, or indeed any method to control the stylesheet order relative to existing standard linked stylesheets.It always adds to the bottom of the head tag, and therefore has to the potential to override existing stylesheets.
  4. Shark75
    Shark75 avatar
    36 posts
    Member since:
    Apr 2007

    Posted 04 Feb 2014 Link to this post

    Wow, thanks for the code, that's really useful. It's disappointing that this proxy isn't in the Telerik RadControls library as it would be very useful.
Back to Top