我正在尝试在ASP.net中建立一个新的网页。我正在使用带有分页的gridview,但是我要使用的CSS类没有得到应用。页面其余部分上的CSS可以正常使用,它与该一个gridview有关。我无法通过Google找到答案。请帮助,任何帮助,感激不尽!
我尝试将CSS类更改为类,尝试更改CSS类,尝试从Site Master中删除CSS链接,尝试从Gridview周围删除DIV容器,但这没有任何区别。
GridView的:
<%--Records of the graphed data --%>
<div class="Records">
<h4>Shutdown Records</h4>
<asp:GridView ID="datagrid" runat="server" DataSourceID="SqlDataSource6" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
PageSize="6" AllowPaging="True" OnPageIndexChanging="datagrid_PageIndexChanging" Width="100%">
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource6" runat="server"
ConnectionString="<%$ ConnectionStrings:Automation %>"
ProviderName="System.Data.SqlClient" SelectCommand="select ShutdownDate, ShutdownNotes, StartupDate, StartupNotes, Cast
(
Round
(
(
Cast
(
SUM(TotalDownTime)as decimal(18, 2)
)/3600
)
, 2
) as decimal(18, 2)
) as 'Duration of Shutdowns (Hours)'
from ProductionShutdownRecord
where Reason like '%'+@Reason+'%'
and ShutdownNotes like '%'+@shutdownNotes+'%'
and StartupNotes like '%'+@startupNotes+'%'
and ShutdownDate >= @startDate
and ShutdownDate <= @endDate
and AMSTaskRelated like
CASE
when @AMS = 1 then '%1%'
else '%%'
END
group by ShutdownDate, ShutdownNotes, StartupDate, StartupNotes
order by shutdowndate asc
">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" DefaultValue="Scheduled Release"
Name="Reason" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="shutdownNotes" ConvertEmptyStringToNull="False"
Name="shutdownNotes" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="startupNotes" ConvertEmptyStringToNull="False"
Name="startupNotes" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="startDate" ConvertEmptyStringToNull="False"
Name="startDate" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="endDate" ConvertEmptyStringToNull="False"
Name="endDate" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="AMSCheck"
Name="AMS" PropertyName="Checked"/>
</SelectParameters>
</asp:SqlDataSource>
</div>
CSS:
/* Gridview Style
-------------------------------------------------------------------------------------------------------------*/
.mGrid {
width: 100%;
background-color: #fff;
margin: 5px 0 10px 0;
border: solid 1px #525252;
border-collapse: collapse;
}
.mGrid td {
padding: 2px;
border: solid 1px #c1c1c1;
color: #717171;
}
.mGrid th {
padding: 4px 2px;
color: #fff;
background: #424242 url(grd_head.png) repeat-x top;
border-left: solid 1px #525252;
font-size: 0.9em;
}
.mGrid .alt {
background: #fcfcfc url(grd_alt.png) repeat-x top;
}
.mGrid .pgr {
background: #424242 url(grd_pgr.png) repeat-x top;
}
.mGrid .pgr table {
margin: 5px 0;
}
.mGrid .pgr td {
border-width: 0;
padding: 0 6px;
border-left: solid 1px #666;
font-weight: bold;
color: #fff;
line-height: 12px;
}
.mGrid .pgr a {
color: #666;
text-decoration: none;
}
.mGrid .pgr a:hover {
color: #000;
text-decoration: none;
}
预期结果:我正在尝试使用此CSS模板:http://atashbahar.com/post/2009-01-23-aspnet-gridview-makeover-using-css
实际结果:我正在获得纯白色的gridview。
为了后人的缘故,这样一个问题才能得到答案,我将在此处写出解决方案。
使用键盘快捷键Ctrl
+Shift
+ R
清除浏览器的缓存。现代的浏览器会缓存javascript和css文件等资源,以便下次访问时加载速度更快。如果您对CSS进行更改但没有出现,则很可能浏览器仍在使用缓存版本。
如果您担心用户看到的是缓存资源而不是更新的资源,请查看这些cache busting techniques以帮助防止这些问题。