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?
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.
The BoundField class is used by data-bound controls (such as GridView and DetailsView) to display the value of a field as text. The BoundField object is displayed differently depending on the data-bound control in which it is used.
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.
.select {
text-decoration: none;
color: Red;
}
<asp:CommandField ShowSelectButton="True">
<ControlStyle CssClass="select" />
</asp:CommandField>
.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With