This is a migrated thread and some comments may be shown as answers.

Remove default RadGrid CSS classes

1 Answer 357 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 11 Oct 2012, 02:20 PM
Is there a way to prohibit default RadGrid CSS classes from being output to the markup? For example I can set my
HeaderStyle
for a column as a CSS class, but then it gets appended with a default RadGrid class like rgHeader or rgGroupCol. I would like this to not happen because when exporting to Excel, when I apply my custom CSS to the RadGrid on the HTMLExporting event, any RadGrid cells that have multiple classes on the like - class="MyCustomCSSClass rgHeader" do not get their styles applied. If I set the CSS class of a cell on ItemDataBound this solves the problem and the default RadGrid classes are not output, but is there a way to make sure no RadGrid default CSS classes are added to any part of the grid?

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 11 Oct 2012, 05:41 PM
Hello,

Modified existing css class using IMPORTANT.
<style type="text/css">
        .RadGrid .rgHeaderDiv
        {
            background-color: Red !important;
        }
    </style>

//OR

<style type="text/css">
        .MyCLass
        {
            background-color: Red ;
        }
    </style>
<telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID">
                    <HeaderStyle CssClass="MyCLass" />
                    </telerik:GridBoundColumn>

//OR

Please write below line in document.ready method or execute with specific timeinterval using JS.

$('.rgHeaderDiv').removeClass('rgHeaderDiv').addClass('YourNewClass');

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or