Group by, hide fieldName

2 posts, 1 answers
  1. James Shelton-Agar
    James Shelton-Agar avatar
    108 posts
    Member since:
    May 2008

    Posted 10 Jan 2011 Link to this post

    Hi, I am using Radgrid with Grupby feature, which works great, except it always showing the field name (I want it to just showing the value, which is a date ):
    my expression setting is as follows. any suggestions?
    <GroupByExpressions>
                 <telerik:GridGroupByExpression>
                     <SelectFields>
                         <telerik:GridGroupByField FieldAlias=" " FieldName="OFIdate" FormatString="{0:D}"
                             HeaderValueSeparator=""></telerik:GridGroupByField>
                     </SelectFields>
                     <GroupByFields>
                         <telerik:GridGroupByField FieldName="OFIdate" SortOrder="Ascending"></telerik:GridGroupByField>
                     </GroupByFields>
                 </telerik:GridGroupByExpression>
             </GroupByExpressions>
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 11 Jan 2011 Link to this post

    Hello James,

    Try the following code snippet to hide the Field name in Group header.

    ASPX:
    <GroupByExpressions>
      <telerik:GridGroupByExpression>
        <SelectFields>
          <telerik:GridGroupByField FieldName="OFIdate" FormatString="{0:D}"></telerik:GridGroupByField>
        </SelectFields>
        <GroupByFields>
          <telerik:GridGroupByField FieldName="OFIdate" SortOrder="Ascending"></telerik:GridGroupByField>
        </GroupByFields>
      </telerik:GridGroupByExpression>
    </GroupByExpressions>

    C#:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
     {
       if (e.Item is GridGroupHeaderItem)
       {
        GridGroupHeaderItem groupHeader = (GridGroupHeaderItem)e.Item;
         {
           groupHeader.DataCell.Text = groupHeader.DataCell.Text.Split(':')[1].ToString() ;
         }
       }
      }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top