AutoSizeColumnsMode = Fill and fixed width columns

2 posts, 0 answers
  1. Michael Yereniuk
    Michael Yereniuk avatar
    10 posts
    Member since:
    May 2008

    Posted 02 Jun 2008 Link to this post

    On a number of my gridviews I have button columns which I want to have set to a fixed width, otherwise they resize very wide which just looks weird.. To add my button column as a fixed width column I do something like this:

            Dim commandColumn As New GridViewCommandColumn() 
            commandColumn.UniqueName = "Command" 
            commandColumn.HeaderText = "" 
            commandColumn.Width = 70 
            commandColumn.MaxWidth = 70 
            commandColumn.MinWidth = 70 

    I also have the grid set to auto resize the columns with:

            Me.GridView1.MasterGridViewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill 

    The problem is that the columns no longer take up the full width of the grid as a result of the fixed width column(s).. When I manually resize the columns, sometimes it will "snap" to the width of the grid, but I want it to be done automatically when the grid loads..

    Any ideas?
  2. Kiril
    Kiril avatar
    158 posts

    Posted 03 Jun 2008 Link to this post

    Hi Michael Yereniuk,

    Thank you for writing.

    The RadGridView does not currently allow to allocate the extra space to any column. It is automatically added to the last column, which in your case is the command column. In the future, we will add this functionality, possibly in the service packs of Q2 2008.

    You can achieve the functionality you're looking for by setting the widths of the other columns youself, just like you do with the command column, or by calling the BestFit function on columns of your choosing.

    I hope this helps.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
Back to Top