Donate

ASP.NET WebForms Change GridView Sort Link Color

Here's how to change the color of GridView SortLink using CSS.
ASPX Markup
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<asp:GridView ID="GridVwPagingSorting" runat="server" AutoGenerateColumns="False" Font-Names="Verdana" AllowPaging="True" AllowSorting="True" PageSize="5" Width="75%" OnPageIndexChanging="PageIndexChanging" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" OnSorting="Sorting">
    <AlternatingRowStyle BackColor="#BFE4FF" />
    <PagerStyle BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" />
    <HeaderStyle CssClass="gridViewHeader" />
    <RowStyle Height="20px" Font-Size="13px" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" />
    <Columns>
        <asp:BoundField DataField="EmployeeID" HeaderText="Employee ID" SortExpression="EmployeeID" />
        <asp:BoundField DataField="Emp_Name" HeaderText="Employee Name" SortExpression="Emp_Name" />
        <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
        <asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" />
    </Columns>
</asp:GridView>
CSS
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
.gridViewHeader 
 {
    height: 30px;
    background-color: #6DC2FF;
    font-size: 15px;
    border-color: #CCCCCC;
    border-style: Solid;
    border-width: 1px;
}

.gridViewHeader a {
    color: rgb(218, 81, 81);
}
Output
ASP.NET WebForms Change GridView Sort Link Color

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.