rao
rao

Reputation: 223

master and content pages

I have a master page and two content pages that uses the master page for layout and design. I have 2 css files for my master page. Now what I want to do is that when I run first content page master page uses the first css file and when I run the second content page it uses the other one. Any suggestions about how should I do this .

Upvotes: 2

Views: 131

Answers (2)

Aristos
Aristos

Reputation: 66641

You can use a ContentPlaceHolder in the master page, and inside the head to change the css differently on every next page, or just ignore it to keep some default.

Here is an example:

<head runat="server">
   <asp:ContentPlaceHolder ID="styleHolder" runat="server" >
    <link rel="stylesheet" type="text/css" href="default.css">
  </asp:ContentPlaceHolder>
</head>
<body>

and inside on the page with the different css, just include the the PlaceHolder and change it.

Upvotes: 0

Jonathan Wood
Jonathan Wood

Reputation: 67193

First off, this should not be your normal approach unless you are doing something unusual. The whole point of using a common master page is so that you can easily have a common look and feel across your website.

But you can do it a few ways. One way would be to put a placeholder in your master pages <head> section. Then create content for that placeholder in each content page that includes the appropriate css file.

Upvotes: 1

Related Questions