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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridListControl width when hidding columns

Thread ID:





22114 Dec 3,2004 07:50 AM UTC Dec 7,2004 10:29 AM UTC WinForms 3
Tags: GridControl
Jose Egea
Asked On December 3, 2004 07:50 AM UTC

Hi: I''m trying to hide several columns in a GridListControl cell using the TableControlCurrentCellShowingDropDown event, but first time I dropdown the cell the grid has the width of the original grid without hiding columns. Second time the gridlistcontrol has resized and appears fine. How can I adjust the gridlistcontrol width first time I display it in the cell? Thanks in advance

Administrator [Syncfusion]
Replied On December 3, 2004 11:06 AM UTC

Are you adjusting e.Inner.Size to reflect the columns you have hidden. Maybe //cr is the cell renderer int height = cr.ListControlPart.Grid.ColWidths.GetTotal(0,cr.ListControlPart.Grid.ColCount); e.Inner.Size = new Size(e.Inner.Width, height);

Paul Laudeman
Replied On December 7, 2004 10:27 AM UTC

Jose, With some help from Clay in a previous post, I''ve used the "CurrentCellShowingDropDown" event and wrote the following code to set the visibility of a column: Private Sub Grid_CurrentCellShowingDropDown(ByVal sender As Object, ByVal e As GridCurrentCellShowingDropDownEventArgs) Handles _grid.CurrentCellShowingDropDown if (someCondtion = True) then grid.Model.Cols.Hidden(1) = True end if end sub Hope that helps, -Paul

Paul Laudeman
Replied On December 7, 2004 10:29 AM UTC

I abbreviated my code example for you and forgot to include the "grid" object variable declaration (add inside the "if" condition check): Dim grid As GridControl = CType(cc.Renderer, GridDropDownGridListControlCellRenderer).ListControlPart.Grid


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon