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

Howto: change font size of a particular column ?

2 Answers 545 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JD.
Top achievements
Rank 1
JD. asked on 24 Sep 2011, 08:16 PM
Hi

I have skin applied to grid.   The value of one column wraps to next line and so
I wanted to change its fontsize to smaller so that it adjusts itself without wraping.

I tried applying CSS for that column, but no effect.

So how can i change fontname and  fontsize of a particular column , both at design and runtime, irrespective of skin applied.

-JD

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 25 Sep 2011, 07:12 PM
Hello,

please check below code snippet.

<style type="text/css">
        .customClass
        {
            font-size : 20px !important;
        }
    </style>
<telerik:GridBoundColumn >
                    <HeaderStyle CssClass="customClass" />
                    <ItemStyle CssClass="customClass" />
 </telerik:GridBoundColumn>

Let me know if any concern.


Thanks,
Jayesh Goyani
0
Princy
Top achievements
Rank 2
answered on 26 Sep 2011, 07:52 AM
Hello J,

You can try the same approach in the ColumnCreated event as well.
C#:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
  if (e.Column.UniqueName == "ColUniqueName")
   {
    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
    boundColumn.HeaderStyle.CssClass = custom;
   }
}
CSS:
<style type="text/css">
     .custom
     {
      font-size  :20px !important;
     }
</style>

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