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

StyleSheetManager does not update head section after ajax postback

5 Answers 141 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
W Klijnsmit
Top achievements
Rank 1
W Klijnsmit asked on 20 Dec 2010, 05:08 PM
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

5 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 20 Dec 2010, 07:05 PM
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.
0
Reggy
Top achievements
Rank 1
answered on 11 Jan 2011, 03:23 PM
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
0
Simon
Telerik team
answered on 17 Jan 2011, 03:35 PM
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.
0
Reggy
Top achievements
Rank 1
answered on 18 Jan 2011, 09:43 AM
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.
0
Imran Javed Zia
Top achievements
Rank 1
answered on 01 Feb 2012, 10:45 AM
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.
Tags
ScriptManager and StyleSheetManager
Asked by
W Klijnsmit
Top achievements
Rank 1
Answers by
Simon
Telerik team
Reggy
Top achievements
Rank 1
Imran Javed Zia
Top achievements
Rank 1
Share this question
or