Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
Autosizing Cell/Column width
posted

Hi,

I want to adjust the column width automatically afte entering text into the UltraGrid cell so that text in all cells of that column get displayed clearly. What i want is - when i enter the long text into the cell, when i leave the focus from that cell, column width should automatically resized to the width of that text. I want the effect which is similar to the - double clicking on middle of two column's header which automatically resizes the column width. Please let me know is there any way to do this programatically.

Thanks in advance,

Ujwal 

 

Parents
No Data
Reply
  • 990
    posted

    Hi Ujwal,

    You need to attach to the AfterCellUpdate event and use the PerformAutoResize method of the Cell's Column.

            private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)

            {

                e.Cell.Column.PerformAutoResize();

            }

    By default the resize is based on visible rows only. There are a number of overloads which allow you to specify other criteria.

    Cheers,

    Andy.

     

Children
No Data