Fixed column + autosized columns

2 posts, 1 answers
  1. redshift20
    redshift20 avatar
    5 posts
    Member since:
    Feb 2013

    Posted 15 May 2017 Link to this post

    I have a gridview with a checkbox column that I would like to remain fixed.. but allow the other columns to auto size.  I'm using the following code:

       gvDocuments.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
       gvDocuments.Columns["Checked"].AutoSizeMode = BestFitColumnMode.None;
       gvDocuments.Columns["Checked"].MaxWidth = 30;
       gvDocuments.Columns["Checked"].MinWidth = 30;
       gvDocuments.Columns["Checked"].Width = 30;
       gvDocuments.Columns["Filename"].Width = 300;
       gvDocuments.Columns["Description"].Width = 300;
       gvDocuments.Columns["DocumentTypeDescription"].Width = 135;
       gvDocuments.Columns["DocumentDate"].Width = 135;


    If you look in the attached screenshot, there is a space between the "Checked" column and the "Description" column.  I'm not sure what I'm doing wrong.


  2. Answer
    Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3568 posts

    Posted 17 May 2017 Link to this post

    Hello Chris, 

    Thank you for writing.  
    You can set the AutoSizeColumnsMode property to Fill and specify the MinWidth and MaxWidth properties of the column to the desired width. Thus, the column will fill the entire grid's width and the column will have a fixed size: 
    public RadForm1()
        this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
        this.radGridView1.Columns["Discontinued"].MinWidth = 20;
        this.radGridView1.Columns["Discontinued"].MaxWidth = 20;

    I hope this information helps. Should you have further questions I would be glad to help.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top