How To Align the grid size

2 posts, 0 answers
  1. Anto (DLL Version : 2008.3.1314.35)
    Anto (DLL Version : 2008.3.1314.35) avatar
    212 posts
    Member since:
    Mar 2009

    Posted 27 Mar 2009 Link to this post

    Hi All

    I have a radgrid with the header and item been taken from code behind.

    In the .cs I have set the width

    My Code:

    protected

    void rgvReport_ColumnCreated(object source, GridColumnCreatedEventArgs e)

     

    {

     

    if (e.Column is GridBoundColumn && !(e.Column.IsBoundToFieldName("Project/Date")))

     

    {

    e.Column.HeaderStyle.HorizontalAlign =

    HorizontalAlign.Center ;

     

    e.Column.ItemStyle.HorizontalAlign =

    HorizontalAlign.Right;

     

    e.Column.HeaderStyle.Width = 55;

    e.Column.ItemStyle.Width = 55;

     

     

    }

     

    else

     

    {

    e.Column.HeaderStyle.Width = 70;

    e.Column.ItemStyle.Width = 70;

    }

    }

    But the header width is different from the Item width.

    Please could anybody tell me how to rectify this problem.

    Thank you

    -Anto

  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 27 Mar 2009 Link to this post

    Anto-

    Have you tried just setting the Header width from code-behind? I think that setting the Header will automatically affect the width of the Items in that column. Give that a try and see what happens.

    -Todd
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top