GridColumn IE Alignment Issues

4 posts, 0 answers
  1. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 10 Jul 2009 Link to this post

    We have a RadGrid on a page that has a first and last column and the columns in the middle are built dynamically based on some criteria. Everything works great and the edit mode is perfect with the exception of one thing - styling with IE. Everything in FF looks perfect and is exactly what we want and after a few tweaks we got it to work with IE8. Unfortunately, in compatibility mode the column alignments are not being honored. Here is what the structure looks like:

    1                 GridNumericColumn col = new GridNumericColumn(); 
    2                 GridTemplateColumnEditor Editor = new GridTemplateColumnEditor() { ID = "Editor" + FieldName }; 
    3  
    4                 rgCalendar.Columns.Add(col); 
    5                 phEditors.Controls.Add(Editor); 
    6  
    7                 col.DataField = FieldName; 
    8                 col.UniqueName = FieldName; 
    9                 col.DataType = typeof(int); 
    10                 col.HeaderText = ScrapType.Name; 
    11                 col.ItemStyle.Width = Unit.Pixel(40); 
    12                 col.ItemStyle.HorizontalAlign = HorizontalAlign.Right; 
    13                 col.ColumnEditorID = Editor.ID; 
    14                 col.HeaderStyle.Wrap = false
    15                 col.HeaderStyle.HorizontalAlign = HorizontalAlign.Right; 
    16  

    Does anyone have any suggestions as to what we can do to ensure the dynamic columns are always right-aligned cross-browser? We're using the default skin with the Q1 2009 release.
  2. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 10 Jul 2009 Link to this post

    As often happens, I figured it out. The column width of 40px was being honored by IE even though the header (set to not wrap) was wider. So it was "right-aligned" in it's 40px wide cell instead of the cell just expanding all the way.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 10 Jul 2009 Link to this post

    Hi digitall,

    In addition, you should set column widths with HeaderStyle.Width, not ItemStyle.Width.

    Greetings,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 10 Jul 2009 Link to this post

    Actually, I won't know the width of the header as it is set to not wrap. Removing the ItemStyle width was sufficient though.

    Thanks!
Back to Top