Radgrid Grouping Group Header Text

3 posts, 1 answers
  1. MarkSci
    MarkSci avatar
    16 posts
    Member since:
    Dec 2011

    Posted 27 Apr 2012 Link to this post

    Hi everyone,

    I have a radgrid which is created enitrely within the code behind. I have enabled grouping which works (sort of - minimising the group doesn't currently work although the page is refreshing), however each group's header text defaults to the following format:

    [Grid ColumnName]: [BoundDataField value]

    One of my columns contains an image determined by the underlying data - which doesn't necessarily make sense to the users and contains capital letters and underscores. Screenshot attached. Is there a way of intercepting this and changing the text?

    Thanks

    Mark
  2. Answer
    Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 30 Apr 2012 Link to this post

    Hello Mark Sci,

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridGroupHeaderItem)
            {
                (e.Item as GridGroupHeaderItem).DataCell.Text = (e.Item as GridGroupHeaderItem).DataCell.Text.Replace("_"," ");
            }
    }



    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. MarkSci
    MarkSci avatar
    16 posts
    Member since:
    Dec 2011

    Posted 30 Apr 2012 Link to this post

    Perfect, thank you Jay!
Back to Top