BoundField style
How can I give style for BoundField?
I开发者_开发技巧'm using BoundField in Gridview. Tt shows an underline and an unwanted color.
How do I remove underline and color?
Depending on what bound field you are trying it might vary a little but here is an example. Each fields has properties for various styles and you can set CssClass
as well.
CommandField
.select {
text-decoration: none;
color: Red;
}
<asp:CommandField ShowSelectButton="True">
<ControlStyle CssClass="select" />
</asp:CommandField>
BoundField
.product {
color: Blue;
}
<asp:BoundField DataField="ProductName" HeaderText="Product Name" ItemStyle-CssClass="product">
<ItemStyle CssClass="product" />
</asp:BoundField>
Go to GridView
Properties → Columns and you will find all your fields listed there. There you can set the style properties of BoundField
.
Another alternative is using a Template Field where you will have more control.
精彩评论