Howto: change font size of a particular column ?

3 posts, 0 answers
  1. JD.
    JD. avatar
    37 posts
    Member since:
    Aug 2012

    Posted 24 Sep 2011 Link to this post

    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. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 25 Sep 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 Sep 2011 Link to this post

    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.
Back to Top