In-line substitution of Font in RadGrid HeaderText

3 posts, 0 answers
  1. frederic
    frederic avatar
    4 posts
    Member since:
    Sep 2014

    Posted 12 Sep 2014 Link to this post

    I am trying to modify the contents of a RadGrid Column HeaderText item in C#.

    I was unable to modify inline font characteristics from within the HeaderText property in the markup, so i tried in the code-behind thusly:

    01.protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    02.        {
    03.            if (e.Item is GridHeaderItem)
    04.            {
    05.                GridHeaderItem header = (GridHeaderItem)e.Item;
    07.                foreach (string col in SysInvCols)
    08.                {
    09.                    Label lbl = new Label();
    10.                    lbl.ID = "Label1";
    11.                    header[col].Controls.Add(lbl);
    12.                    lbl.Text = "E";
    13.                    lbl.Font.Name = "Windings 3";
    14.                }
    15.            }

    Unfortunately, the font is not modified as i would expect.  Is there another way to do what i'm trying to do?

    Note: ASCII Character Code 69, the captial letter E in latin, and in wingdings 3 it is a pair of arrows (one pointing up and the other pointing down).

    Please see attached image for clarity.

  2. frederic
    frederic avatar
    4 posts
    Member since:
    Sep 2014

    Posted 12 Sep 2014 in reply to frederic Link to this post

    Unfortunately, I forgot to mention that the output just appends a capital E to the end of the headerText item in the grid column, and that the variable sysInvCols is a list of string values equal to the column header names.
  3. Pavlina
    Pavlina avatar
    6162 posts

    Posted 17 Sep 2014 Link to this post


    Could you try setting different font to the header text inside grid PreRender event and let me know about the result.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top