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

[Solved] Overriding Button Skin in Grid

2 Answers 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 08 Sep 2009, 04:08 PM

Hi,

I have a Button skin file that does skinning for the ASP.NET Button control. The problem I have is it is overriding the button within the RadGrid. For example, the Add new and Refresh buttons are shown in the same style as the other buttons on my website are.  The button skin seems to override the styles applied even though I have the !important setting set. 

This is my skin file to control Buttons:

asp:Button runat="server" CssClass="MainButton"></asp:Button>

 Here is the pertinent css inside my custom css class:

 .RadGrid_[myskinname].rgAdd   
 {  
background-position:0 -1856px !Important;   
}  
.RadGrid_[myskinname].rgRefresh   
{  
background-position:0 -1824px !Important;   
}  
.RadGrid_[myskinname].rgEdit   
{  
background-position:0 -1888px !Important;   
}  
.RadGrid_[myskinname].rgDel   
{  
background-position:0 -1920px !Important;   
}  
.RadGrid_[myskinname] .rgAdd,  
.RadGrid_[myskinname] .rgRefresh,  
.RadGrid_[myskinname] .rgEdit,  
.RadGrid_[myskinname] .rgDel,  
.RadGrid_[myskinname] .rgFilter,  
.RadGrid_[myskinname] .rgPagePrev,  
.RadGrid_[myskinname] .rgPageNext,  
.RadGrid_[myskinname] .rgExpand,  
.RadGrid_[myskinname] .rgCollapse,  
.RadGrid_[myskinname] .rgSortAsc,  
.RadGrid_[myskinname] .rgSortDesc   
.RadGrid_[myskinname] .rgUpdate,  
.RadGrid_[myskinname] .rgCancel   
{  
      width:16px !important;  
      height:16px !important;  
      border:0 !important;  
      padding:0 !important;  
      background-color:transparent !important;  
      background-image:url('Grid/sprite.gif') !important;  
      background-repeat:no-repeat !important;  
      vertical-align:middle !important;  
      cursor:pointer !important;  
}  
 

Is there any way to prevent RadGrid from inheritting the ASP.NET Skin file?

Thanks, Josh

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 09 Sep 2009, 07:59 AM
Hi Josh,

Please set EnableTheming="false" to RadGrid or use SkinIDs to apply the theme styles only to the buttons that need them.

All the best,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Josh
Top achievements
Rank 1
answered on 09 Sep 2009, 01:09 PM
Dimo,

Thanks, I independently came to the same conclusion last night.
By the way, I had to switch EnableTheming = "True" in the user control.

Thanks for the reply,
Josh
Tags
Grid
Asked by
Josh
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Josh
Top achievements
Rank 1
Share this question
or