We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Resize column based DropDownUserControl value

I''m using a drop down user control to allow users to select a value for a cell. What I want to happen when the user selects a value is for the column width to resize to fit the selected text. I''ve tried handling the CurrentCellChanged event and using the ResizeToFit method, but the CurrentCellChanged event doesn''t fire when the user selects a value from the drop down user control. Is there some other event I should be handlling? Thanks Akash

8 Replies

AD Administrator Syncfusion Team October 10, 2005 01:33 PM UTC

Try using the CurrentCellCloseDropDown event. If the CurrentCell is your special dropdown, then first call grid.CurrentCell.ConfirmChanges and then make your ResizeToFit call.


AD Administrator Syncfusion Team October 11, 2005 11:57 AM UTC

Sorry Clay, that didn''t work. I''ve modified the dropdownusercontrol sample to illustrate. Note that the resize works when called from form_load but not when called from Grid_CurrentCellCloseDropDown. By the way, I''m using v3.3.0. Akash P.S. Upload doesn''t seem to be working at the moment - will try to upload the sample later.


AD Administrator Syncfusion Team October 11, 2005 07:05 PM UTC

The upload facility still seems to be broken...I''ve tried it from home and the office. Any ideas?


AD Administrator Syncfusion Team October 11, 2005 07:21 PM UTC

You can email it to support@syncfusion.com and mention this thread in its title. Also update this thread so I will know when you have sent it.


AD Administrator Syncfusion Team October 11, 2005 08:57 PM UTC

I''ve emailed the sample as you suggested. Thanks.


AD Administrator Syncfusion Team October 11, 2005 09:49 PM UTC

In CurrentCellCloseDropDown, try this code: Me.gridControl1.CurrentCell.EndEdit() Me.gridControl1.Model.ColWidths.ResizeToFit(GridRangeInfo.Cols(0, Me.gridControl1.ColCount), GridResizeToFitOptions.None)


AD Administrator Syncfusion Team October 12, 2005 09:56 AM UTC

Thanks Clay, that worked. On a related note, is there any documentation that describes the grid event model at a higher level than the Class Reference? I''m looking for something that describes the sequence of events that occur, and how the various methods relate to those events. Such documentation could help with queries such as this one, as the chances of stumbling upon the EndEdit method by trawling through the class reference are minimal. Thanks Akash


AD Administrator Syncfusion Team October 12, 2005 10:00 AM UTC

Currently, there is not such a document. In the CellType samples, there is a tracing utility that lets you display currentcell events being hit in a trace log window. That is one way to see what events are raised as you edit and move from cell to cell.

Loader.
Live Chat Icon For mobile
Up arrow icon