Column Size on Reorder

2 posts, 0 answers
  1. Ryan
    Ryan avatar
    5 posts
    Member since:
    Oct 2008

    Posted 26 Dec 2008 Link to this post

    When a user moves a column in the grid to a new location, it occupies the same space that the column that was in that spot takes up.  I am setting the HeaderStyle-Width property in the aspx for each GridBoundColumn. 
  2. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 28 Dec 2008 Link to this post

    Hello Ryan,

    By default, when you reorder a column, it remains the same size (width) regardless of where it is placed in the column order. If you want to keep the columns sized relative to their position, you can use the RadGrid's ColumnsReorder event to set change their sizes. Here is an example of how you might handle that event:

    protected void RadGrid1_ColumnsReorder(object source, Telerik.Web.UI.GridColumnsReorderEventArgs e) 
        var sourceWidth = e.Source.HeaderStyle.Width; 
        var targetWidth = e.Target.HeaderStyle.Width; 
        e.Source.HeaderStyle.Width = targetWidth; 
        e.Target.HeaderStyle.Width = sourceWidth; 

    I hope this helps. Please let me know if you have any further questions.

    Kevin Babcock
  3. DevCraft R3 2016 release webinar banner
Back to Top