asp net master page css not applying to asp form pages

0 votes

I am new to asp.net programming and have come into this unusual error. I have a master page called Master.Master which contains the following code for specifying a CSS file.

<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>

    <asp:ContentPlaceHolder ID="Stylesheets" runat="server">
        <link rel="stylesheet" href="~/Styles/StyleSheet.css" type="text/css" />
    </asp:ContentPlaceHolder>
</head>

note that for the master page the CSS works perfectly with no issues, I have since created a default asp web form which takes all contents from the Master.Master page. This page however is not displaying the CSS at all, here is that pages code.

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

from researching this issue many users on here even suggested using script language for resolving URL like such, but to no avail.

<a runat="server" href="<%= this.ResolveUrl(~/Styles/StyleSheet.css) %>" onmouseover="document.Home_Img.src='<%= this.ResolveUrl("Images/home_2.png") %>'"
        onmouseout="document.Home_Img.src='<%= this.ResolveUrl("Images/home.png") %>'">
        <img alt="" src="Images/home.png" name="Home_Img" runat="server" />
    </a>

thanks in advance

Jun 9, 2022 in CSS by Edureka
• 13,620 points
2,305 views

1 answer to this question.

0 votes

just try the following code:

<head>
    <link rel="stylesheet" href="~/Styles/StyleSheet.css" type="text/css" />
</head>
answered Jun 13, 2022 by Edureka
• 12,690 points

Related Questions In CSS

0 votes
1 answer

Rails - how to integrate a form with bootstraps css?

Here is how I did it  in my ...READ MORE

answered Jun 28, 2022 in CSS by Edureka
• 12,690 points
1,137 views
0 votes
1 answer

I am not able to create CSS Dropdown menu

Use any element to open the dropdown ...READ MORE

answered Jun 28, 2022 in CSS by Edureka
• 12,690 points
591 views
0 votes
1 answer

How to convert a web page(html,css,js) into android app?

I used Phonegap a lot for this, ...READ MORE

answered Jun 28, 2022 in CSS by Edureka
• 12,690 points
1,400 views
0 votes
1 answer

input[type='text'] CSS selector does not apply to default-type text inputs?

Because that is not what it is ...READ MORE

answered Jun 28, 2022 in CSS by Edureka
• 12,690 points
1,539 views
0 votes
0 answers

How to write a simple Html.DropDownListFor()?

I want to create a very straightforward ...READ MORE

Jul 8, 2022 in HTML by Tejashwini
• 3,820 points
388 views
0 votes
1 answer

Authenticate on an ASP.Net Forms Authorization website from a console app

Essentially, we need to record a regular ...READ MORE

answered Sep 20, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
842 views
0 votes
1 answer

Writing SEO friendly url gets infinite loop asp.net

you should know that regex avoid cases ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,720 points
756 views
0 votes
0 answers

How to get Bitcoin value for corresponding USD value in ASP.NET C#?

I want to get the Bitcoin value ...READ MORE

Mar 1, 2022 in Blockchain by Soham
• 9,710 points
780 views
0 votes
1 answer

CSS to make HTML page footer stay at bottom of the page with a minimum height, but not overlap the page

A simple solution is to make the ...READ MORE

answered Jun 21, 2022 in CSS by Edureka
• 12,690 points
4,135 views
0 votes
1 answer

How to create material design input form using css and bootstrap?

Try with this code. HTML: <div class="main_div"> ...READ MORE

answered Jun 21, 2022 in CSS by Edureka
• 12,690 points
2,418 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP