Gridview样式的CSS控制
页面代码:
01.<asp:GridView ID="gvCustomres" runat="server" 02. DataSourceID="customresDataSource" 03. AutoGenerateColumns="False" 04. GridLines="None" 05. AllowPaging="true" 06. CssClass="mGrid" 07. PagerStyle-CssClass="pgr" 08. AlternatingRowStyle-CssClass="alt"> 09. <Columns> 10. <asp:BoundField DataField="CompanyName" HeaderText="Company Name" /> 11. <asp:BoundField DataField="ContactName" HeaderText="Contact Name" /> 12. <asp:BoundField DataField="ContactTitle" HeaderText="Contact Title" /> 13. <asp:BoundField DataField="Address" HeaderText="Address" /> 14. <asp:BoundField DataField="City" HeaderText="City" /> 15. <asp:BoundField DataField="Country" HeaderText="Country" /> 16. </Columns> 17.</asp:GridView> 18.<asp:XmlDataSource ID="customresDataSource" runat="server" DataFile="~/App_Data/data.xml"></asp:XmlDataSource>
css代码
01..mGrid { 02. width: 100%; 03. background-color: #fff; 04. margin: 5px 0 10px 0; 05. border: solid 1px #525252; 06. border-collapse:collapse; 07.} 08..mGrid td { 09. padding: 2px; 10. border: solid 1px #c1c1c1; 11. color: #717171; 12.} 13..mGrid th { 14. padding: 4px 2px; 15. color: #fff; 16. background: #424242 url(grd_head.png) repeat-x top; 17. border-left: solid 1px #525252; 18. font-size: 0.9em; 19.} 20..mGrid .alt { background: #fcfcfc url(grd_alt.png) repeat-x top; } 21..mGrid .pgr { background: #424242 url(grd_pgr.png) repeat-x top; } 22..mGrid .pgr table { margin: 5px 0; } 23..mGrid .pgr td { 24. border-width: 0; 25. padding: 0 6px; 26. border-left: solid 1px #666; 27. font-weight: bold; 28. color: #fff; 29. line-height: 12px; 30. } 31..mGrid .pgr a { color: #666; text-decoration: none; } 32..mGrid .pgr a:hover { color: #000; text-decoration: none; }
标签:
C#
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南