techques
asked on
How C# ResolveClientUrl in Masterpage
There is a masterpage in asp.net which I want to use
<link href="<%= this.ResolveClientUrl("~/s cript/css/ test.css") %>" type="text/css" rel="stylesheet">
When I see the view source in IE, it becomes empty:
<link href="" type="text/css" rel="stylesheet">
I also tried <%= Request.ApplicationPath %> + /script/css/test.css
It only showed /script/css/test.css
How should I use ResolveClientUrl in Masterpage? as the current relative path needs ../../script/css/test.css which work. Otherwise, it does not work
<link href="<%= this.ResolveClientUrl("~/s
When I see the view source in IE, it becomes empty:
<link href="" type="text/css" rel="stylesheet">
I also tried <%= Request.ApplicationPath %> + /script/css/test.css
It only showed /script/css/test.css
How should I use ResolveClientUrl in Masterpage? as the current relative path needs ../../script/css/test.css which work. Otherwise, it does not work
ASKER
It does not work, it shows
href="script/css/test.css"
but not href="../../script/css/tes t.css"
The aspx page placed in
/product/info/index.aspx
it calls the master page which in root directory
The header html code saved in a html file.
<head runat="server">
<title></title>
<script></script>
<link href="<%= Page.ResolveClientUrl("~") %>script/css/test.css" type="text/css" rel="stylesheet" />
</head>
and located in
/product/info/header.html
I use Server.MapPath to load the html in index.aspx.cs Page_Load
ParseControl and add to the PlaceHolder in masterpage.
All code in html can display properly.
However, only Page.ResolveClientUrl("~") become empty.
If I put ResolveClientUrl in index.aspx.cs, it can show ../../script/css/test.css
If I put Page.ResolveClientUrl in masterpage, it can also show
../../script/css/test.css
However, when I parse the header.html to the placeholder controller, it becomes empty.
How should I fix it?
I tried many methods to do it but still failed.
href="script/css/test.css"
but not href="../../script/css/tes
The aspx page placed in
/product/info/index.aspx
it calls the master page which in root directory
The header html code saved in a html file.
<head runat="server">
<title></title>
<script></script>
<link href="<%= Page.ResolveClientUrl("~")
</head>
and located in
/product/info/header.html
I use Server.MapPath to load the html in index.aspx.cs Page_Load
ParseControl and add to the PlaceHolder in masterpage.
All code in html can display properly.
However, only Page.ResolveClientUrl("~")
If I put ResolveClientUrl in index.aspx.cs, it can show ../../script/css/test.css
If I put Page.ResolveClientUrl in masterpage, it can also show
../../script/css/test.css
However, when I parse the header.html to the placeholder controller, it becomes empty.
How should I fix it?
I tried many methods to do it but still failed.
change the code to
<head runat="server">
<title></title>
<script></script>
<link href="~/script/css/test.cs s" type="text/css" rel="stylesheet" />
</head>
<head runat="server">
<title></title>
<script></script>
<link href="~/script/css/test.cs
</head>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<link href="<%= Page.ResolveClientUrl("~")