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

Column Headers add space in front of capital letters?

3 Answers 529 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Joel asked on 16 Feb 2011, 04:51 PM
This is the first I have run into this.  Is there a way to turn the behavior off?  Grid is populated with needdatasource event.

If a column name in my datatable is "SuperMan", the column header in the grid is displayed as "Super Man" (note the space in front of "M").  If the column name in my database is  "superman" then the column header in the grid is "superman".  Is there some option where I can turn off renaming my column headers?  We capitalize for readability, but need the names to stay in tact so users can do excel lookups.

This particular page returns a variety of different datatables with different formats, most approx 50 columns wide so my preference is to not build lots of pages with predefined column headers to work around this.

Thanks!

-Joel
<telerik:RadGrid ID="rgExport" runat="server" Skin="WebBlue" AllowPaging="true" PageSize="20">
</telerik:RadGrid>

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Feb 2011, 11:22 AM
Hello Joel,

Try the following code snippet in ColumnCreated event and check if it resolves the issue.

C#:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        string name = e.Column.HeaderText;
        e.Column.HeaderText=name.Replace(" ", string.Empty);
    }

Thanks,
Princy.
0
Joel
Top achievements
Rank 2
answered on 17 Feb 2011, 02:00 PM
Thanks Princy.  I had thought about something like that, but some column headers should have spaces in them and unless I hardcode a library of headers to remap, it wouldn't work in my situation.  This is definitely new behavior as the client's existing site does not  do this, but they are about a year out of date on their radcontrols.

I need "District Manager" and "RoiQ1" to be able to be in the same grid like it used to be without defining each column manually.  Being a new feature (and an odd one), there has to be a way to turn this off in the grid or mastertableview definitions I would think?
0
Marin
Telerik team
answered on 23 Feb 2011, 09:03 AM
Hello Joel,

Indeed since Q3 2010 we introduced a new property EnableSplitHeaderText of MasterTableView that controls the automatic splitting of the header text for autogenerated columns. Its default value is true, to disable splitting set it to false.

Regards,
Marin
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
Joel
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Joel
Top achievements
Rank 2
Marin
Telerik team
Share this question
or