Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 990
joji Avatar asked Jan 07 '11 07:01

joji


People also ask

How do you style 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.

What is BoundField?

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.


1 Answers

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.

like image 197
gbs Avatar answered Sep 20 '22 00:09

gbs