How to Change GridGroupHeaderItem Font Size?

4 posts, 0 answers
  1. Radha
    Radha avatar
    8 posts
    Member since:
    Jul 2008

    Posted 05 Aug 2010 Link to this post

    am attaching Screen shot...

    in that Screen shot .How to change highlight Font Color
    that he lighting line was using GridGroupByField ..

    am using below code 

    am using This Way ..
    protected void rgMyFile_ItemCreated(object sender, GridItemEventArgs e)
            if (e.Item is GridGroupHeaderItem)
                (e.Item as GridGroupHeaderItem).Font.Size = FontUnit.Point(30);
                (e.Item as GridGroupHeaderItem).Font.Bold = true;
    but its Not Working
    protected void rgMyFile_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

    if (e.Item is GridGroupHeaderItem)
                GridGroupHeaderItem item = e.Item as GridGroupHeaderItem;
                 e.Item.Font.Size = FontUnit.Point(430);
                e.Item.Font.Bold = true;
                e.Item.CssClass = "rgGroupHeader";

     <telerik:RadGrid ID="rgMyFile" runat="server"  ShowGroupPanel="false" AutoGenerateColumns="False" DataSourceID="odsMyFile" GridLines="None" EnableEmbeddedSkins="true"  Skin="Default" OnItemDataBound="rgMyFile_ItemDataBound"   OnItemCreated="rgMyFile_ItemCreated" ShowStatusBar="True" >
            <MasterTableView DataSourceID="odsMyFile"  ShowHeader="False">
                                <telerik:GridGroupByField FieldAlias="SessionName" FieldName="SessionName" FormatString="{0:s}"
                                    HeaderValueSeparator=" : " HeaderText=""></telerik:GridGroupByField>
                HeaderText="Course Name" FieldAlias="CourseName" FormatString=""/>
                                <telerik:GridGroupByField FieldName="SessionName" SortOrder="Descending" FieldAlias="SessionName" FormatString="" HeaderText=""></telerik:GridGroupByField>
            <Columns >
                                        <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="File Name">
                                                <asp:ImageButton ID="imgbtn" runat="server" Width="20px" Height="20px" Enabled="false" />
                                                    <asp:Label ID="fileType" runat="server" Text='<%#Eval("FileType") %>' ></asp:Label>
          <GroupHeaderItemStyle CssClass ="rgGroupHeader" />

    using This way also not Working.
    give me any solution
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Aug 2010 Link to this post


    Give a try with following code to customize the group header item.

    Code behind:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
           if (e.Item is GridGroupHeaderItem)
                GridGroupHeaderItem header = (GridGroupHeaderItem)e.Item;
                header.Style.Add("font-size", "30px");

  3. Sagar
    Sagar avatar
    1 posts
    Member since:
    May 2013

    Posted 12 Dec 2013 Link to this post

    hi shinu

       i want to change color of group header as per condition. but in itemdataboud first execute for header n second time execute for GridDataItem, so i want to change color as per condition on GridDataItem, n apply on gruop header,

  4. Angel Petrov
    Angel Petrov avatar
    1044 posts

    Posted 17 Dec 2013 Link to this post

    Hello Sagar,

    For achieving this goal you can subscribe to the PreRender event and traverse the items in order to check whether the relevant GridGroupHeaderItem should be colored or not. Later using the GetItems method you can obtain a reference to the headers and apply the styles.

    I strongly suggest that you revise this help article which demonstrates a similar approach. The example does not follow the exact requirements but illustrates how you can reference the headers in the PreRender event which can help you in the process of implementation.

    Angel Petrov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top