why my css file doesn't reload? - html

I have an aspx page with two css links:
<link rel="Stylesheet" type="text/css" href="<%=MyPath %>/Profile.css" id="Link1" runat="server" visible="false" />
<link href="../../Style/ProfileMenu.css" rel="stylesheet" visible="true" />
Each take care of different elements and no dupliacate class names.
when I run the code it works perfect, when i click submit the page reloads but the second css doesnt work.
I tried adding to the first css all the info from the second css and delete the second css (use only one css per page) and nothing changed.
I guess there is a problem with postback..
why ? how to fix it ? how can i check it?

Related

Weird Ghost CSS Bug

How is it possible that my whole website works normally without the css file with all the styles? I have this line in the header:
<link rel="stylesheet" type="text/css" href="styles.css" />
I deleted the only styles.css file from the server, but nothing changed. If I delete that line from the header then there are no styles (as expected)
At one point I noticed that none of the css changes I make have any effect, so I made sure that i'm not doing something dumb like editing or referencing the wrong file and that there are not 2 copies of it for some reason. If I change other html files, then I can see the effects, but not the styles file.
I can force it to work by renaming the css file, but I don't really want to do that.
Has anyone seen this happen before?
This is because caching of the CSS. So try clearing the cache of the browser.
You can prevent the CSS caching by below way
<link rel="stylesheet" type="text/css" href="style.css?v=1" />
Using PHP you can do this trick
<link rel="stylesheet" type="text/css" href="style.css?<?php echo date('l jS \of F Y h:i:s A'); ?>" />

Asp GridView Pagination custom CSS works in Design View but not in browser

I'm using Bootstrap and have got a custom css link for the pagination in a gridview and all the of the CSS works from both pages, my master page has this:
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
In the aspx page I have something along the lines of..
<asp:GridView ID="grid_view_search" runat="server" onprerender="GridView_PreRender" DataSourceID="sql_data_source_search" AutoGenerateColumns="False" DataKeyNames="ID" CssClass="table table-hover table-condensed table-bordered" AllowSorting="True" AllowPaging="True">
<Columns>
//Columns here
</Columns>
<PagerSettings Mode="NumericFirstLast" />
<PagerStyle CssClass="pagination-bootstrap" HorizontalAlign="Center" />
</asp:GridView>
This has all worked and is styled correctly apart from the "pagination-bootstrap" which in a browser just looks like the standard style for gridview (i.e. 12) however in the design view it is loaded the way it is meant to look (i.e. [1][2])
I've been playing around with it and tried putting the style in the gridview opening tag line. Online I only found answers where the links to the css file or images were starting with "~/css" but I don't believe it is that as the other bits I added to the style.css file are working perfectly fine.
Any help will be much appreciated
[Edit] Added images of what it looks like in design view and in a browser
Design View:
Browser:
I found the answer was that the CSS was being cached so in order to refresh the page to get the updated CSS file I had to press Ctrl-F5 which then reloaded the page with the proper style for the pagination.
Make sure to check out this article "Use Bootstrap Pagination On Gridview"
https://sufiawan.wordpress.com/2014/09/26/asp-net-use-bootstrap-pagination-on-gridview/

Using runat="server" in stylesheet link not resolving

I'm trying to include a stylesheet in one of my aspx pages. The stylesheet is in the directory /Dir1/style.css (relative to the project root). I'm trying to get it to resolve in a page that's at the path: /Dir1/MyPage.aspx. I'm aware that I could just include the stylesheet in the header, since it's in the same directory, but I'm trying to use the runat="server" tag so that it would be easier to move the page later if needed.
This is the line I'm using:
<link runat="server" rel="stylesheet" href="~/Dir1/style.css" type="text/css" media="all"/>
Everything I read indicate this is supposed to work, but no matter what I do, I get a 404 in the browser for that stylesheet. The runat attribute doesn't seem to be doing anything - the path the browser is trying to fetch ends up being: http://localhost:7205/Dir1/~/Dir1/style.css. What am I doing wrong?
try this:
<link runat="server" rel="stylesheet" href="<%= Page.ResolveUrl("~/Dir1/style.css") %>" type="text/css" media="all"/>
And you should not need the runat=server

Spring add CSS to different pages

I have 2 pages:
http://local.host:8080/test/login
http://local.host:8080/test/admin/manage
Added css in login.jsp using c:url:
<c:url value="css/style.css"/>
When I open 1st link - everything works well. I tried to add the same style.css file to manage.jsp (2nd URL), but when I open 2nd link - css is not included. In Page Source I have:
<link rel="stylesheet" type="text/css" href="css/style.css"/>
How to define to take style.css from the root of URL (http://local.host:8080/test) ?
I think it is, because the specified path is relative to the current page (login is at an other level of path-nesting* than admin/manage).
A trivial but bad solution would be adding ../ for the css of admin/manage. But this soultion has the drawback, that you always need to adjust the ../ when you change the level of path-nesting* for an page.
To overcome this problem, make the path in the c:url-tag start with an /! (this make the tag aware that the url is context relative (relative to http://local.host:8080/test/), and the tag will automatically addhttp://local.host:8080/test` in front.
<c:url value="/css/style.css"/>
will be rendered to : http://local.host:8080/test/css/style.css
For the link use this way
<c:url value="/css/style.css" var="cssUrl"/>
<link rel="stylesheet" type="text/css" href="${cssUrl}"/>
*I do not know the correct term for "path nesting" at the moment - fell free to change it
Order of attribute might be the problem. Correct the order
<link href="css/style.css" rel="stylesheet" type="text/css" />

jqTouch css and a href link

I am trying to call a link from a page which points to another part of the page.
This is the code I am using to do this:
<img src="Dress1.jpg" alt="Pic1"></img>
The problem is that when I remove the css stylesheet links from the page, in other words:
<link type="text/css" rel="stylesheet" media="screen" href="jqtouch/jqtouch.css">
<link type="text/css" rel="stylesheet" media="screen" href="themes/jqt/theme.css">
It actually works but with the above links, it doesn't work.
Instead all it does is change the address (by adding #product) and doesn't display the image requested in
I'm not sure what could be wrong.
Thanks.
C.
Depending on which revision of jQTouch that you are using, you will need to add an animation class to your link like slide/flip/disolve in order to actually cause a transition from one psuedo page to the next.
<img src="Dress1.jpg" alt="Pic1"/>
not sure what you are trying to do. in your example, the image is in the link, not the target div. from your description it sounds like you might want something like
See my image
<div id="product"><img src="Dress1.jpg" alt="Pic1"/></div>