J
JT
Hi,
I have done a fair amount of style editing inline in ASP. I'm now
using VS 2005 with a standard web project (not Web Application
Project). This is my first foray into CSS in a style sheet and also my
first true attempt at using master pages. I tried setting up a style
sheet with a simple setting to float an image to the right and it had
no effect on the image.
Then, I tried putting the style code in my ASPX file as such,
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile =
"~/MyMaster.master" CodeFile="ProductDetails.aspx.cs"
Inherits="ProductDetails" %>
<style type="text/css">
img
{
float:right;
border:1px dotted black;
margin:0px 0px 15px 20px;
}
</style>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain"
Runat="Server">
<aspanel ID="pnlProduct" runat="server" Height="50px"
Style="z-index: 100;
position: relative;" >
<asp:Label ID="lblManufacturer" runat="server" Font-Bold="True"
Font-Underline="True"
Style="z-index: 101; position: relative;"
Text="Manufacturer" Font-Size="X-Large"></asp:Label>
<br />
<asp:Label ID="lblProductName" runat="server" Font-Bold="True"
Font-Underline="True"
Style="z-index: 100; position: relative;" Text="Product
Name"></asp:Label>
<br />
</aspanel>
<aspanel ID="pnlDescription" runat="server" Height="50px"
Style="z-index: 102;
position: relative; text-align: left" Width="873px">
<asp:Literal ID="ltrDescription" runat="server"></asp:Literal>
</aspanel>
</asp:Content>
It complained that "Content is not supported outside 'script' or
'asp:content' regions".
I tried moving the style setting inside the asp:content region and it
complained that "Element 'style' cannot be nested within element 'td'".
This is because my ContentPlaceHolder is inside a table in my master
page. As of yet, I can't get the desired layout without doing that.
I created a new page, ProductDetails2.aspx, as a stand-alone Web Form
page, inserted the style element into the head element and now it
works, but I don't have the menu and other standard page formatting
that was contained in the master page. So my questions are:
1. What do I need to do to make my style settings work with pages that
reference my master page? Do I need to take away all formatting that
would require the style element to be nested?
2. Do I need to reference my stylesheet like you would reference a DLL?
3. Does including a stylesheet in the solution/project automatically
apply it to all pages in the project?
Thanks for your help.
I have done a fair amount of style editing inline in ASP. I'm now
using VS 2005 with a standard web project (not Web Application
Project). This is my first foray into CSS in a style sheet and also my
first true attempt at using master pages. I tried setting up a style
sheet with a simple setting to float an image to the right and it had
no effect on the image.
Then, I tried putting the style code in my ASPX file as such,
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile =
"~/MyMaster.master" CodeFile="ProductDetails.aspx.cs"
Inherits="ProductDetails" %>
<style type="text/css">
img
{
float:right;
border:1px dotted black;
margin:0px 0px 15px 20px;
}
</style>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain"
Runat="Server">
<aspanel ID="pnlProduct" runat="server" Height="50px"
Style="z-index: 100;
position: relative;" >
<asp:Label ID="lblManufacturer" runat="server" Font-Bold="True"
Font-Underline="True"
Style="z-index: 101; position: relative;"
Text="Manufacturer" Font-Size="X-Large"></asp:Label>
<br />
<asp:Label ID="lblProductName" runat="server" Font-Bold="True"
Font-Underline="True"
Style="z-index: 100; position: relative;" Text="Product
Name"></asp:Label>
<br />
</aspanel>
<aspanel ID="pnlDescription" runat="server" Height="50px"
Style="z-index: 102;
position: relative; text-align: left" Width="873px">
<asp:Literal ID="ltrDescription" runat="server"></asp:Literal>
</aspanel>
</asp:Content>
It complained that "Content is not supported outside 'script' or
'asp:content' regions".
I tried moving the style setting inside the asp:content region and it
complained that "Element 'style' cannot be nested within element 'td'".
This is because my ContentPlaceHolder is inside a table in my master
page. As of yet, I can't get the desired layout without doing that.
I created a new page, ProductDetails2.aspx, as a stand-alone Web Form
page, inserted the style element into the head element and now it
works, but I don't have the menu and other standard page formatting
that was contained in the master page. So my questions are:
1. What do I need to do to make my style settings work with pages that
reference my master page? Do I need to take away all formatting that
would require the style element to be nested?
2. Do I need to reference my stylesheet like you would reference a DLL?
3. Does including a stylesheet in the solution/project automatically
apply it to all pages in the project?
Thanks for your help.