Skip to main content

Adding Style to BoundField in asp.net


You can add Styles to BoundField In Gridview Like this

.select{
text-decoration:none;
color:Red;

cursor :pointer ;
}
.product{
color:Blue;
}

<asp:CommandField ShowSelectButton="True">
    <ControlStyle CssClass="select" />
</asp:CommandField>
<asp:BoundField DataField="ProductName" HeaderText="Product Name" ItemStyle-CssClass="product">
        <ItemStyle CssClass="product" />
</asp:BoundField>

Another good alternative is using a Template Field where you will have more control.

Comments