Column Headers add space in front of capital letters?

4 posts, 0 answers
  1. Joel
    Joel avatar
    174 posts
    Member since:
    Oct 2006

    Posted 16 Feb 2011 Link to this post

    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.


    <telerik:RadGrid ID="rgExport" runat="server" Skin="WebBlue" AllowPaging="true" PageSize="20">
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 17 Feb 2011 Link to this post

    Hello Joel,

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

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

  3. Joel
    Joel avatar
    174 posts
    Member since:
    Oct 2006

    Posted 17 Feb 2011 Link to this post

    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?
  4. Marin
    Marin avatar
    1057 posts

    Posted 23 Feb 2011 Link to this post

    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.

    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!
Back to Top