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

Group by, hide fieldName

1 Answer 275 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James Shelton Agar
Top achievements
Rank 2
James Shelton Agar asked on 11 Jan 2011, 05:40 AM
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>

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 11 Jan 2011, 06:07 AM
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.
Tags
Grid
Asked by
James Shelton Agar
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or