[英]Background color for agrid view?
我在我的应用程序中使用网格视图。 我想为每行设置替代颜色。.考虑到网格视图有10行,这意味着奇数行应包含红色,偶数行应包含绿色。
可能吗 ? 如果这样请告诉我! 提前致谢。
简单的一个:
<asp:gridview id="CustomersGridView"
datasourceid="CustomersSource"
autogeneratecolumns="true"
emptydatatext="No data available."
runat="server">
<rowstyle backcolor="Red"
forecolor="Black" />
<alternatingrowstyle backcolor="Green"
forecolor="Black" />
</asp:gridview>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:sqldatasource id="CustomersSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.