Solve: Partial rendering updates the page but CSS styles are lost.

In IE,  if you have a style-sheet updated to certain component (server component) and if they are inside update panel when a ajax post back happens you might loose the style-sheet.

I faced this problem while working on a small user control which is like toolbar. I have created that with LinkButton controls and when i placed this user control inside update-panel after click on the link entire style sheet goes off from the link button.

This bug was reported way back in 2006 and it happens only in IE. It seems like MS is not interested to fix this but either in Atlas or in IE and has closed this issue by calling it an Behaviour By Design.

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=103134

There is a way around to fix this issue. I have added following code in OnInit Event of my user control and i got styles retained on link button.

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
ScriptManager sm = ScriptManager.GetCurrent(Page);
if (!sm.IsInAsyncPostBack)
{
string css = """;

Prakash Software Solutions PVT LTD. Offer wide range of services to their clients all over the globe. We successfully delivered projects i.e. software development, cloud computing solutions, SharePoint development solutions, mobile app development and Microsoft technology solution to our Sweden, Denmark, Netherlands, France, Norway, Germany, Spain, Italy, Switzerland, Belgium, Luxembourg, Ireland, United Kingdom, United States, Canada, Brazil, Peru, UAE, Dubai, Saudi Arabia, Kuwait, Qatar, Bahrain, Singapore, New Zealand and Australia Clients.

Related Posts

Leave a reply