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

Overwrite header background color of custom skin

6 Answers 184 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 06 Jan 2011, 05:11 PM
Hi all,

I'm having a custom skin which is modified from Telerik Skin.
EnableEmbeddedSkins="false" Skin="MySkin"

In my website, user has his/her own favorite color. And I would like to apply that color for Grid header.
For example, user A has Orange color and the background color of RadGrid header must be orange. 

Are there any ways to modify the "MySkin"?

Regards,

Andy.

EnableEmbeddedSkins="false" Skin="MySkin"

6 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 06 Jan 2011, 05:34 PM
Hi Andy,

Try using the code snippet below to override the background image and replace it with a color of your choice:
CSS:
<style type="text/css"
    div.RadGrid_MySkin th.rgHeader 
    
        background-image: none
        background-color: #ba000c
    
</style>

Give it a try and let me know how it goes.

Greetings,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Andy
Top achievements
Rank 1
answered on 07 Jan 2011, 01:04 AM
Hi Pavlina,

Thanks for your response.
I don't think that code can solve my problem, Pavlina.
I already have a custom skin all the users share together. In that, it defines the border color, filter color, edit mode color, etc.
They just have one different thing is header background color. 
And I don't want to create one CSS for each user. My purpose is using one CSS for all users and overwrite header background color in the server code depends on specific user.

Thanks.

Andy.
0
Pavlina
Telerik team
answered on 07 Jan 2011, 03:08 PM
Hi Andy,

To achieve your goal you need to remove the background image from header cells as shown below:

<style type="text/css">  
    div.RadGrid_MySkin th.rgHeader  
    {  
        background-image: none;  
    }  
</style>

and then to set HeaderStyle-BackColor programmatically for each user.

Best wishes,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Pavlina
Telerik team
answered on 07 Jan 2011, 03:12 PM
Hi Andy,

To achieve your goal you need to remove the background image from header cells as shown below:

<style type="text/css">  
    div.RadGrid_MySkin th.rgHeader  
    {  
        background-image: none;  
    }  
</style>

and then to set HeaderStyle-BackColor programmatically for each user.

Best wishes,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Andy
Top achievements
Rank 1
answered on 07 Jan 2011, 05:02 PM
Hi Pavlina, 

That's what I need.
Thanks for your help.

Here is the code for changing header background color if someone needs
Protected Sub dgList_ItemDataBound(ByVal sender As System.Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles dgList.ItemDataBound
       If TypeOf e.Item Is GridHeaderItem Then
           Dim header As GridHeaderItem = DirectCast(e.Item, GridHeaderItem)
           header.BackColor = Color.Violet
       End If
End Sub

Andy.
0
Pavlina
Telerik team
answered on 07 Jan 2011, 05:46 PM
Hello Andy,

I am glad I could help in your implementation. Please do not hesitate to let us know if you need additional assistance.

Greetings,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Andy
Top achievements
Rank 1
Share this question
or