Results 1 to 3 of 3

Thread: Change GridView Sort Link from blue to different color

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Change GridView Sort Link from blue to different color

    Tried this:

    <HeaderStyle CssClass="headerstyle" />

    And in the css:

    .headerstyle a{
    text-decoration:none;
    color:#7dad4a;
    display:block;
    }

    But nothing...
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Change GridView Sort Link from blue to different color

    Using ASP.NET 4.0 with masterpage, what I did was create an external css file and add reference to it in the aspx file.

    External css file (GridViewHeader.css)
    css Code:
    1. .gridViewHeader
    2.  {
    3.     height: 30px;
    4.     background-color: #6DC2FF;
    5.     font-size: 15px;
    6.     border-color: #CCCCCC;
    7.     border-style: Solid;
    8.     border-width: 1px;
    9. }
    10.  
    11.  
    12. .gridViewHeader a {
    13.     color: rgb(218, 81, 81);
    14. }

    .aspx file with gridview using masterpage (Add Reference using link rel).
    html Code:
    1. <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    2.     <link rel="stylesheet" href="Styles/GridViewHeader.css"/>
    3. </asp:Content>
    4. <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    5.     <asp:GridView ID="GridVwPagingSorting" runat="server" AutoGenerateColumns="False"
    6.                 Font-Names="Verdana" AllowPaging="True" AllowSorting="True" PageSize="5" Width="75%"
    7.                 OnPageIndexChanging="PageIndexChanging" BorderColor="#CCCCCC" BorderStyle="Solid"
    8.                 BorderWidth="1px" OnSorting="Sorting">
    9.                 <AlternatingRowStyle BackColor="#BFE4FF" />
    10.                 <PagerStyle BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" />                
    11.                 <HeaderStyle  CssClass="gridViewHeader" />
    12.                 ......
    13.             </asp:GridView>
    14. </asp:Content>
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Change GridView Sort Link from blue to different color

    Using ASP.NET 4.0 with masterpage, what I did was create an external css file and add reference to it in the aspx file.

    External css file (GridViewHeader.css)
    css Code:
    1. .gridViewHeader
    2. {
    3. height: 30px;
    4. background-color: #6DC2FF;
    5. font-size: 15px;
    6. border-color: #CCCCCC;
    7. border-style: Solid;
    8. border-width: 1px;
    9. }
    10.  
    11.  
    12. .gridViewHeader a {
    13.     color: rgb(218, 81, 81);
    14. }

    .aspx file with gridview using masterpage (Add Reference using link rel).
    aspx Code:
    1. <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    2. <link rel="stylesheet" href="Styles/GridViewHeader.css"/>
    3. </asp:Content>
    4. <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    5. <asp:GridView ID="GridVwPagingSorting" runat="server" AutoGenerateColumns="False"
    6. Font-Names="Verdana" AllowPaging="True" AllowSorting="True" PageSize="5" Width="75%"
    7. OnPageIndexChanging="PageIndexChanging" BorderColor="#CCCCCC" BorderStyle="Solid"
    8. BorderWidth="1px" OnSorting="Sorting">
    9. <AlternatingRowStyle BackColor="#BFE4FF" />
    10. <PagerStyle BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" />
    11. <HeaderStyle CssClass="gridViewHeader" />
    12. ......
    13. </asp:GridView>
    14. </asp:Content>
    Last edited by KGComputers; May 25th, 2014 at 09:49 PM.
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width