column width C1GridView

Posted by: pverdaas on 10 September 2017, 11:29 am EST

  • Posted 10 September 2017, 11:29 am EST

    How can i get the column widths of the columns of the C1GridView

    I've tried the ItemStyle.Width but this one is always empty........

     

    for (int i = 0; i < this.C1GridViewItems.Columns.Count; i++)
                {
                    C1BoundField bc = new C1BoundField();
                    bc = (C1BoundField)this.C1GridViewItems.Columns[i];              
                    this.bc.ItemStyle.Width;
                }

     

    Thanks,

     

    Paul

  • Replied 10 September 2017, 11:29 am EST

    Hi,
     
    Column width is determined by the
    C1BaseColumn.ItemStyle.Width if it was explicitly set (in the designer, for
    example).
    In scrolling mode the widths for columns (if not explicitly set) is
    determined by C1GridView.DefaultColumnWidth.
     
    The following pseudo-code illustrates how to get
    column width on the server:
     
    Unit width = (grid.ScrollSettings.ScrollMode !=
    C1GridViewScrollMode.None &&
    column.ItemStyle.Width.IsEmpty)
       ?
    grid.DefaultColumnWidth
       : column.ItemStyle.Width;
     
    Regards,
    Sergey.
    style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    wrote: href="news:227094@10.0.1.98">news:227094@10.0.1.98...

    How can i get the column widths of the columns of the C1GridView


    I've tried the ItemStyle.Width but this one is always empty........


     


    for (int i = 0; i < this.C1GridViewItems.Columns.Count;
    i++)
               
    {
                   
    C1BoundField bc = new
    C1BoundField();
                   
    bc =
    (C1BoundField)this.C1GridViewItems.Columns[i];              

                   
    this.bc.ItemStyle.Width;

                }


     


    Thanks,


     


    Paul




    href="http://helpcentral.componentone.com/cs/forums/p/81767/227094.aspx#227094">http://helpcentral.componentone.com/cs/forums/p/81767/227094.aspx#227094

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels