• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 567
  • Last Modified:

Changing css in masterpage

I have a masterpage that contains my all the css for my website, what i'm looking for is an easy way to change to other css files using a drop down box.

I would like the specific code needed to do this including the drop down box (just write it on a bare page)
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" bare"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    <title>test</title>
    
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
    
    <style type="text/css">
        @import "style.css";
    </style>
    
</head>

Open in new window

0
mitpat
Asked:
mitpat
1 Solution
 
Amandeep Singh BhullarCommented:
Check the discussion,
http://www.daniweb.com/forums/thread68595.html

Hope this will help you
0
 
lazyberezovskyCommented:
Add link with runat="server" to your master page:
<head>
  <link id="linkStyles" rel="stylesheet" type="text/css" runat="server" />
</head><head>

In code behind add SelectedIndexChanged event handler to your DropDownList:
void dropDownList1_SelectedIndexChanged(Object sender, EventArgs e)
{
  string stylesheet = // get stylesheet address e.g. Server.MapPath(ropDownList1.SelectedItem.Text)
  linkStyles.Href = stylesheet;
}
0
 
robastaCommented:
you can customize this javascript to use drop down.

http://www.thesitewizard.com/javascripts/change-style-sheets.shtml
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now