StyleSheetManager does not update head section after ajax postback

6 posts, 0 answers
  1. W Klijnsmit
    W Klijnsmit avatar
    6 posts
    Member since:
    Aug 2007

    Posted 20 Dec 2010 Link to this post

    Good day,

    I have a question regarding the usage of the StyleSheetManager in combination with Ajax Postbacks.

    In some application scenarios we'd like to add stylesheets to the StyleSheets collection of the StyleSheetManager depending on the usercontrol we are loading after a javascript postback.

    For instance:
    - A button in an UpdatePanel is clicked
    - An AJAX Postback occurs
    - New Usercontrol is added to the controls collection of the Page
    - Page_Init event of the new control is fired:

    protected void Page_Init(object sender, EventArgs e)
    {
        RadStyleSheetManager.GetCurrent(Page).StyleSheets.Add(new StyleSheetReference("KaosCore.Style.Widgets.FeedWall.css", "KaosCore"));
     
         
     
        RadScriptManager.GetCurrent(Page).Scripts.Add(new ScriptReference("KaosCore.Javascript.Widgets.FeedWall.js"));
     
    }

    - The scriptmanager loads its newly added script after the AJAX postback.
    - The StyleSheetManager doen't seem to load the newly added stylesheet.

    It looks like the RadStyleSheetManager loads only the Stylesheets added to the collection when the page is fully loaded ( !IsPostBack ).

    Is there any way we can let the stylesheetmanager update the stylesheets in the head section with the current StyleSheets collection after an ajax postback?

    Thanks in advance.

    Regards,
    P. van de Kamp
    Application Developer

  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 20 Dec 2010 Link to this post

    Hello W Klijnsmit,

    With Q3 2010 we fixed an issue where RadStyleSheetManager was unable to combine and load style sheets after AJAX.

    What is your version of Telerik.Web.UI? Could you please test with the latest version?

    Kind regards,
    Simon
    the Telerik team
    Browse the vast support resources we have to jump start 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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Reggy
    Reggy avatar
    6 posts
    Member since:
    Apr 2010

    Posted 11 Jan 2011 Link to this post

    Hello,

    I'm curious if this problem was solved for W. Klijnsmit. We are currently experiencing the same issue in a similar scenario. We are also using the Q3 2010 release (2010.3.1109.40 to be exact).

    Any other tips would be appreciated!

    Kind regards,
    Reggy
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 17 Jan 2011 Link to this post

    Hi Reggy,

    I once again tested this with the latest version of Telerik.Web.UI and can confirm that it works. I am adding an embedded style sheet reference on postback (which is an AJAXified one) to the RadStyleSheetManager in the OnInit method. Please see the attached test project as an example.

    Best wishes,
    Simon
    the Telerik team
    Browse the vast support resources we have to jump start 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.
  6. Reggy
    Reggy avatar
    6 posts
    Member since:
    Apr 2010

    Posted 18 Jan 2011 Link to this post

    Thank you for the sample project. I'm unable to get my situation working though. I've created a sample project to reproduce my situation, but I don't seem to be able to include .zip files as attachment! :(


    Cheers,

    Reggy

    *edit: I have opened a support ticket and included the mentioned .zip file.
  7. Imran Javed Zia
    Imran Javed  Zia avatar
    55 posts
    Member since:
    Jul 2009

    Posted 01 Feb 2012 Link to this post

    Hi Reggy,

    Were you able to get it working? I am facing same issue in my scenario. Please do update me if you got any fix or work around.

    Thanks.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017