IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact
You are here: Home / .NET / How to Override Telerik RadGrid CSS

How to Override Telerik RadGrid CSS

If you use Telerik’s RadGrid but don’t want to use the default styling template, there’s a quick way to apply your own CSS style to it. This may not be as sophisticated as using the skinning feature, but it surely does the trick.

The first thing we need to do is to write the custom css style, then assign it to CssClass attribute within the RadGrid markup. We also need to add Skin attribute with an empty value.

So we’re going to create the custom CSS first, then add the two attributes on the RadGrid Control markup as shown in the example below:

Create Custom CSS

RadGrid is rendered as an HTML table on the ASP.NET page, so make sure you style it as a table element. In this example, we’ll name our CssClass element rgview.

<style type="text/css">
    .rgview table
    {
        border-collapse: collapse;
        background: #ebf1de;
    }
    .rgview th, .rgview td
    {   
        padding: 4px 8px;
    }
    .rgview th
    {            
        background-color: #8064a2;
        color: #fff;
        border: 1px solid #ccc;
    }
    .rgview th a
    {
        color: #fff;
        text-decoration: none;
    }
    .rgview tr:hover
    {   
        background: #d8e4bc;
    }
    .rgview td
    {
        border: 1px solid #ccc;            
    }
</style>

Add Markup Attributes

Add Skin=”” and assign the css to CssClass attribute. See the highlighted section.

<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0"
    DataSourceID="dsITNota"
    GridLines="None"
    AllowPaging="true" 
    AutoGenerateColumns="false" 
    ShowStatusBar="true"
    OnItemUpdated="RadGrid1_ItemUpdated" 
    OnItemCommand="RadGrid1_ItemCommand" 
    OnPreRender="RadGrid1_PreRender"
    CssClass="rgview" Skin="">
    
   ...

</telerik:RadGrid>

That’s all there is to it. Here are the screenshots to show the difference between the default and custom style.

Default

Telerik RadGrid Default Style

Custom

Telerik RadGrid Custom Style

July 24, 2013 Filed Under: .NET Tagged With: ASP.NET

Buy me a coffee?

Buy me a coffee If you find any of the articles or demos helpful, please consider supporting my work here, you'll have my big thanks!

Comments

  1. AMPACK says

    December 12, 2022 at 6:13 pm

    Hello there! Do you know if they make any plugins to assist with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good success. If you know of any please share. Thank you!

    Reply
  2. Bar says

    January 18, 2021 at 2:11 am

    WhatHappening i am new to this, I stumbled upon this I have discovered It positively helpful and it has helped me out loads. I’m hoping to contribute & help other customers like its helped me. Good job.

    Reply
  3. Zine Aissaoui says

    July 3, 2019 at 2:54 am

    nice job, and pager style?

    Reply
  4. disque en aluminium says

    June 11, 2018 at 8:17 pm

    Howdy just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Firefox. I’m not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I’d post to let you know. The design look great though! Hope you get the problem resolved soon. Thanks

    Reply
  5. _ says

    October 10, 2014 at 8:09 am

    Fantastic! works a charm thank you very much for posting!

    Reply
    • platt says

      October 13, 2014 at 7:17 pm

      You’re welcome 🙂

      Reply
  6. Jeff Meyer says

    September 25, 2014 at 5:38 pm

    Thank-you VERY much for this post. Pesky Radgrids, and their collapsing empty table cells…

    Reply
    • platt says

      September 27, 2014 at 12:38 pm

      Hi Jeff, I’m glad it helped. Thanks for the feedback.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure