Tomazaz
asked on
styleSheetTheme and full url
Hello,
I use style sheets in ASP.NET application <pages styleSheetTheme="t_native" >
When I open asp.net web page in browser I see that
<link href="App_Themes/t_native/ main.css" type="text/css" rel="stylesheet" />
added to web page. Everything is correct except that I need to use full URL of css file, now it is "App_Themes/t_native/main. css", I need to have "http://www.mydomain.com/App_Themes/t_native/main.css"
How to do that?
I use style sheets in ASP.NET application <pages styleSheetTheme="t_native"
When I open asp.net web page in browser I see that
<link href="App_Themes/t_native/
added to web page. Everything is correct except that I need to use full URL of css file, now it is "App_Themes/t_native/main.
How to do that?
ASKER
I need to use full url as I asked because I am rewriting url dynamically in my asp.net application.
So my actual url of asp.net applications look like
http://www.convertcenter.com/convertunit.aspx/Data_Storage
and in this case relative/absolute URLs do not works. I need to use full URL.
So my actual url of asp.net applications look like
http://www.convertcenter.com/convertunit.aspx/Data_Storage
and in this case relative/absolute URLs do not works. I need to use full URL.
I am not sure if this works, just try it out.
1. Have a Literal control, as <asp:Literal ID="litStyle" runat="server"><asp:Litera l>
2. In the Code file in wherever method you want just assign the value of link to the text property as
litStyle.Text = "<link href=\"http://www.mydomain.com/App_Themes/t_native/main.css\" type=\"text/css\" rel=\"stylesheet\" />";
1. Have a Literal control, as <asp:Literal ID="litStyle" runat="server"><asp:Litera
2. In the Code file in wherever method you want just assign the value of link to the text property as
litStyle.Text = "<link href=\"http://www.mydomain.com/App_Themes/t_native/main.css\" type=\"text/css\" rel=\"stylesheet\" />";
why can not put the tag
directly in the ASPX page?
directly in the ASPX page?
ASKER
I can but I will loose CSS in design time, also I do not want to use hack, ASP.NET offer style sheet solution.
Yes obviously. Coz, the full url will always work, even if you do a URL rewrite, when you put it directly as I said in the first post.
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="App_Themes/t_native/
the page that contains this code will take the context and load the style from the location. You never need to use a full path. Even if you want to use then,
<link href="http://www.mydomain.com/App_Themes/t_native/main.css" type="text/css" rel="stylesheet" />
I think it is advisable to use the first one, as even if the web address changes, you never need to worry about the path.