Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 513723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:27:05+00:00 2026-05-13T07:27:05+00:00

I have recently upgraded to ASP.NET AJAX application. I have two css files in

  • 0

I have recently upgraded to ASP.NET AJAX application. I have two css files in an ASP.NET theme. I use any one of the css per postback depends upon a condition.

Previously with my non-AJAX ASP.NET application, what I used to do is

protected void Page_PreRender(object sender,
                                  EventArgs eventArgs)
    {
        ControlCollection headCollection = Header.Controls;

        for (int i = 0; i < headCollection.Count; i++)
        {
            Control temp = headCollection[i];
            if (temp is HtmlLink)
            {
                if (/* condition to loads a.css */)
                {
                    if (((HtmlLink) temp).Href.EndsWith("a.css", true, null))
                    {
                        headCollection.RemoveAt(i);
                        break;
                    }
                }
                else
                {
                    if (((HtmlLink) temp).Href.EndsWith("b.css", true, null))
                    {
                        headCollection.RemoveAt(i);
                        break;
                    }
                }
            }
        }
    }

But this piece of code does not work when I migrated to ASP.NET AJAX. I have inspected and found that only the loaded css from the first request persists. i.e., if a.css is loaded on the first request, and then b.css is required to be loaded on a specific postback does not work.

Please comment if you are confused about the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:27:06+00:00Added an answer on May 13, 2026 at 7:27 am

    Thanks Unholy, solved the problem using jQuery and selector.

    Just used this:

    $("head > link[href$='a.css']").remove();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently upgraded my ASP.NET MVC application from beta to version 1. And
I have recently upgraded some of my web applications to ASP.NET 3.5 by installing
We use an Reporting Services inside an ASP.NET web application. (We have an *.rdlc
We have an ASP.NET MVC application that just recently started forcing IE into IE9
I have recentely upgraded a website to use ASP.NET MVC 4 and have the
I have an ASP.NET 1.1 website and was recently upgraded to Visual Studio 2008.
I've recently taken an existing ASP.NET 3.5 web forms application that was upgraded to
We have recently upgraded from Delphi 2009 to 2010. One of the things in
We've recently upgraded one of our SSRS2005 servers to SSRS2008 and have found that
We have recently upgraded from mvc2 to mvc3 and one of our Custom Authorization

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.