Thursday, June 14, 2012

How to: Add CSS file in ASP.NET at runtime

Adding CSS file in ASP.NET programatically

HtmlGenericControl si = new HtmlGenericControl();
si.TagName = "link";
si.Attributes.Add("type", "text/css");
si.Attributes.Add("href", "css/module.css");
si.Attributes.Add("rel", "stylesheet");


  1. This is a simple ASP.NET code to what I have seen before in one forum being used for the same purpose. That was really confusing and didn't understand what exactly it want to say. This code is really easy to follow and even understable to what it means.

  2. Hi, thanks for sharing. That is very simple piece of code. If you want to get such simple solutions, just call this guys I'm sure they will help you.

  3. : best software Development Company in Canada

    Imagine the trajectories of Business Goals, Engineering, Design, and Programming dynamically merging to deliver great software. This is the spirit of Trajectus.
    Each project is a unique undertaking. Best software development company in Canada.
    Our goal is to work with our customers to understand your business objectives, engineer a proficient platform, create a beautiful interface, and create clean code. The key to success is ensuring the project's core business needs are met. We’ll work with you to ensure there is a clear understanding of the core business needs.

    We approach software challenges with the idea of engineering the best solution, utilizing the best technologies, to solve a business goal. You’ll often find our competitors have assembled talent that corresponds to the preferred language of its leadership or aligns itself with a certain technology stack. We approach each business challenge or partnership as a unique opportunity. As a true engineering company, it’s important to look at all the potential technologies in the market. Trajectus blends good Engineering Principles, a sound Project Management Methodology, and a diverse team of technologists to form solutions to meet the needs of our clients. Our project methodology enables us to leverage a distributed agile software development environment. The Trajectus team is comprised of experienced Architects, Designers, Project Managers, Business Analysts, and experienced Business Development personnel. Our team members possess a diverse set of technology skills and we have an extensive network of specialists. Team members are located throughout the US and our Offshore Delivery center is based in Hyderabad, India. Our methodology enables us to utilize US resources to engage in an in-depth collaborative development process while leveraging skilled resources to minimize distributed risks, bringing affordability to our clients.
    We deliver high quality solutions at a fair price while achieving our targeted deadlines. Most importantly, we are going to produce software to meet your goals.