Problems with Photoshop files inserted in Masterpage

Asked

Viewed 158 times

1

I can’t use a function contained in a file that is inserted in a Masterpage. Where can I am missing?

Follow the Masterpage tag

<head runat="server">
    <title></title>
    <link href="Content/css/bootstrap.css" rel="stylesheet" type="text/css"/>
    <script src="Scripts/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="Scripts/bootstrap.min.js" type="text/javascript"></script>
  <script type="text/javascript" src="Scripts/Formatacao.js"></script>


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

1 answer

0


I believe the problem lies in the hierarchy of your files, for example:

--- Aplicacao/
    ---- Scripts/
    ---- Content/
    ---- MinhaPasta/
         ---- MinhaPaginaQueNaoFunciona.aspx
    ---- Site.Master

What happens is when you walk into MinhaPasta for you to access the files in the folder Scripts does not work the src="Scripts/jquery-2.1.4.min.js" because he interprets it as src="MinhaPasta/Scripts/jquery-2.1.4.min.js"

To solve this directory problem you can use the .ResolveUrl, thus:

<link href='<%= ResolveUrl("~/Content/css/bootstrap.css") %>' rel="stylesheet" type="text/css"/>
<script src='<%= ResolveUrl("~/Scripts/jquery-2.1.4.min.js") %>' type="text/javascript"></script>
<script src='<%= ResolveUrl("~/Scripts/bootstrap.min.js") %>' type="text/javascript"></script>
<script src='<%= ResolveUrl("~/Scripts/Formatacao.js") %>' type="text/javascript"></script>
  • Perfect! Just lost the css. But I came back the old.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.