KavyaVS
asked on
Why CSS Styles are not applying to User Controls when referred it in .aspx page which using content controls.
I created a footerPage.ascx user control for footer content of .aspx page.I am registering it in page which using content and Table controls.The User control using css style sheets.
When I registered the user control in page by <%@ Register TagPrefix="ctr" TagName="Footer" Src="../footerPage.ascx" %>the styles are not applying to User Control.
Markup:
<asp:TableFooterRow>
<asp:TableCell>
<ctr:Footer ID="FtrPage" runat="server" />
</asp:TableCell>
</asp:TableFooterRow>
Please any suggestions.
Thanks
When I registered the user control in page by <%@ Register TagPrefix="ctr" TagName="Footer" Src="../footerPage.ascx" %>the styles are not applying to User Control.
Markup:
<asp:TableFooterRow>
<asp:TableCell>
<ctr:Footer ID="FtrPage" runat="server" />
</asp:TableCell>
</asp:TableFooterRow>
Please any suggestions.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am referring the css file in .ascx file.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="footerPage.asc x.cs" Inherits="Products.footerP age" %>
<link href="~/css/Products.css" rel="stylesheet" type="text/css" />
I am confused with the links you sent.
Please let me know what to do. I am already refering it in .ascx file.
Thanks
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="footerPage.asc
<link href="~/css/Products.css" rel="stylesheet" type="text/css" />
I am confused with the links you sent.
Please let me know what to do. I am already refering it in .ascx file.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is my User Control.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="footerPage.asc x.cs" Inherits="products.footerP age" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<link href="~/css/products.css" rel="stylesheet" type="text/css" />
<div id="footer_bkgd_int">
<br />
<div id="footer_icons" class="grid_11">
<img id="footer_icon1" src="../assets/footer.icon .gif" />
<img id="footer_icon2" src="../assets/footer.icon 2.gif" />
</div>
<div id="footer_content" class="grid_11">
Copyright 2012. All rights reserved.
<br/><br/>
This web site,is the only authorized web site.
<br/><br/>
</div>
</div>
This is the css class I am applying to user control.
.grid_11
{
display:inline;
float: left;
position: relative;
margin-left: 10.0px;
margin-right: 10.0px;
}
I tried to use this css in .aspx page by two ways.
1.When I tried to add link to css in .aspx page it is giving the error.
<link href="~/css/product.css" rel="stylesheet" type="text/css" />
content is not supported outside script or content regions.
2.<asp:TableFooterRow >
<asp:TableCell >
<ctr:Footer ID="FtrPage" runat="server" />
</asp:TableCell>
</asp:TableFooterRow>
I tried to add the class grid_11 at user control mark up.But it is not working. How to make it work.
Thanks
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="footerPage.asc
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<link href="~/css/products.css" rel="stylesheet" type="text/css" />
<div id="footer_bkgd_int">
<br />
<div id="footer_icons" class="grid_11">
<img id="footer_icon1" src="../assets/footer.icon
<img id="footer_icon2" src="../assets/footer.icon
</div>
<div id="footer_content" class="grid_11">
Copyright 2012. All rights reserved.
<br/><br/>
This web site,is the only authorized web site.
<br/><br/>
</div>
</div>
This is the css class I am applying to user control.
.grid_11
{
display:inline;
float: left;
position: relative;
margin-left: 10.0px;
margin-right: 10.0px;
}
I tried to use this css in .aspx page by two ways.
1.When I tried to add link to css in .aspx page it is giving the error.
<link href="~/css/product.css" rel="stylesheet" type="text/css" />
content is not supported outside script or content regions.
2.<asp:TableFooterRow >
<asp:TableCell >
<ctr:Footer ID="FtrPage" runat="server" />
</asp:TableCell>
</asp:TableFooterRow>
I tried to add the class grid_11 at user control mark up.But it is not working. How to make it work.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I added this line in .aspx page.
<asp:Content ID="Content1" ContentPlaceHolderID="Head Content" runat="server">
<link href="~/css/products.css" rel="stylesheet" type="text/css" />
</asp:Content>
I Removed this line from ascx.I didn't remove the class used in the div in ascx.
<link href="~/css/products.css" rel="stylesheet" type="text/css" />
But there is no change. The css styles are not applying to user control.
Are there any other suggestions please.
Thanks
<asp:Content ID="Content1" ContentPlaceHolderID="Head
<link href="~/css/products.css" rel="stylesheet" type="text/css" />
</asp:Content>
I Removed this line from ascx.I didn't remove the class used in the div in ascx.
<link href="~/css/products.css" rel="stylesheet" type="text/css" />
But there is no change. The css styles are not applying to user control.
Are there any other suggestions please.
Thanks
ASKER
Thanks
ASKER
I am referring it in web.config file by using this line <pages theme="Default_Theme">
Is there anything else I need to do.
Thanks