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

Style changes in Sharepoint web part

1 Answer 28 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 25 Feb 2009, 06:30 PM
Greetings,

I'm using the RadGrid control as part of a Sharepoint web part. I need to be able to change the font and color fopr some items. I can't seem to grasp the concept of overriding any css styles. As an example I need to change the HeaderStyle font to "Trebuchet MS" but can't seem to figure that part out. I also need to change the alternating itemstyle backcolor to "#f6f6f6", but I only get actual color names in the intellisense. So I'm assuming that I need to override that somehow.

The web part is built programatically.

If anyone can help me that'd be great.

Thanks,

-Matt

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 Mar 2009, 09:14 AM
Hello Matthew,

You can set programmatically a Trebuchet MS font family to RadGrid headers like this:

C#

RadGrid1.HeaderStyle.Font.Name = "Trebuchet MS";


As for the background color, the BackColor property does not accept HEX colors at runtime, but you can use

C#

RadGrid1.MasterTableView.AlternatingItemStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#f6f6f6");


or supply the decimal equivalent of F6F6F6:

C#

RadGrid1.MasterTableView.AlternatingItemStyle.BackColor = Color.FromArgb(246, 246, 246);


In my opinion, the way is to use a CSS class:

C#

RadGrid1.MasterTableView.AlternatingItemStyle.CssClass = "MyAltClass"

CSS

.MyAltClass
{
      background: #f6f6f6;
}


Greetings,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or