Question

I'm using asp.net in VS 2012. I create a master page and design into it main section and using CSS and JS in it. Now i add a content page. But i have a problem:
--Why can't i see my css effects in content page?
the master page name is "amood.master" and the content page is "aboutUS.aspx".
For more explain:"I see css effects in master page but when using acontent page,all of css effect are disable!!! WHY? "
Source code of web form:

<%@ Page Title="" Language="C#" MasterPageFile="~/amood.Master" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="newMetroDesign.WebForm3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>

this is master page code:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="amood.master.cs" Inherits="newMetroDesign.amood" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">

         <link href="CSS/Stylesss.css" rel="stylesheet" />
    <script src="js/dw_tooltip_c.js" type="text/javascript"></script>
    <link href="css/ex.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" >
        dw_Tooltip.defaultProps = {
            //supportTouch: true, // set false by default
            wrapFn: dw_Tooltip.wrapTextByImage
        }


        dw_Tooltip.content_vars = {
            L2: {
                caption: 'برنامه نويس', // optional caption 


                txt: 'مهدي تحصيلداري<br/>و پايگاه داده  C#.NET برنامه نويس<br/>m.tahsildari@gmail.com',
                w: 200
            },
            L3: {
                caption: 'طراح سايت', // optional caption 

                txt: 'حميد طالبي<BR/>طراح و برنامه نويس سايت<BR/>mr.talebihamid@hotmail.com',
                w: 200
            }
        }


    </script>

    </asp:ContentPlaceHolder>
</head>
<body>
        <div id="MASTERheader">
            <div id="masterlogocontainer">
                <ul>
                    <li class="logo">
                        <a class="headMenu ">
                            <div class="masterlogop"></div>
                        </a>
                    </li>
                    <li>
                        <a>
                            <img src="IMAGES/sadlogo.png" alt="logo" width="80" height="80" />

                        </a>
                    </li>
                </ul>
            </div>
            <div id="masternav">
                <ul>
                    <li >
                        <a href="#">
                        <img src="IMAGES/Telephone.png" /><br />

                        <span>تماس با ما</span>
                             </a>
                    </li>
                    <li >
                        <img src="IMAGES/About.png" /><br />
                        <a href="aboutus.aspx"></a>
                        <span>درباره ما</span>
                    </li>
                    <li >     
                        <a href="default.aspx">
                        <img src="IMAGES/Brush.png" />
                        <span> طراحی</span>

                        </a>
                    </li>
                    <li  >
                         <a href="default.aspx">
                        <img src="IMAGES/Market.png" /><br />

                        <span>محصولات</span>
                         </a>
                    </li>
                </ul>
            </div>
        </div>

    <div style="height:50px;"></div>

        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        <div id="mastercontent">

        </div>
        </asp:ContentPlaceHolder>
    <a id="return" href="default.aspx">
            <div class="btnreturn">
                بازگشت
            </div>
        </a>
        <%--************************ FOOTER *****************************--%>

     <div id="masterfooter">
            <p>گروه طراحان ساد</p>

            <p>     آدرس دفتر مرکزي : مشهد – خيابان احمدآباد – رضا 16  - پلاک 67 </p>
            <p>All Rights Reserved For SAAD Co.  &nbsp; &copy; 2013</p>
                <p>  <a class="showTip L3 colour" href="#"> طراحي</a> و <a class="showTip L2 colour" href="#"> برنامه نويسي </a></p>

        </div>

</body>
</html>

master page without web form

master page with web form

Was it helpful?

Solution

One of the possible reason is that CSS start referencing the path in case of each page relative to itself. So you have to make sure , your master page as well as pages should follow the same relative structure . Example

           mysite.css
           Master.master
           MyPage.aspx

Other way

          mysite.css
          Shared/Master.master
          Admin/MyPage.aspx
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top