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 celltype

Thread ID:





19403 Sep 24,2004 07:01 PM UTC Sep 24,2004 10:24 PM UTC WinForms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On September 24, 2004 07:01 PM UTC

Hi, I have a cell formatted like: gbcc["Code"].StyleInfo.DataSource = new DataView(this.dataSet351.paycodes, "bktype=''" + this.bktype + "''", "[Pay Code]", DataViewRowState.CurrentRows); gbcc["Code"].StyleInfo.CellType = "GridListControl"; gbcc["Code"].StyleInfo.DropDownStyle = GridDropDownStyle.AutoComplete; gbcc["Code"].StyleInfo.CellValueType = typeof(String); gbcc["Code"].StyleInfo.DisplayMember = "Pay Code"; gbcc["Code"].StyleInfo.ValueMember = "Pay Code"; was wondering how to hide the bktype col which is needed only for filtering, and be able to right justify another string column. a strange thing that happens is the more i drop the gridlist down the wider the last col gets. thanks

Administrator [Syncfusion]
Replied On September 24, 2004 07:37 PM UTC

Hi Colin, Hiding Column: -------------- You can hide the columns in the dropdown list by accessing the embedded grid in CurrentCellShowingDropDown. Please refer this KB article: http://www.syncfusion.com/Support/article.aspx?id=10353 // Adjust the properties in the Embedded Grid cr.ListControlPart.Grid.ColWidths[1] = 30; cr.ListControlPart.Grid.SetRowHidden(1,2,true); Alignment: ---------- You can subscribe to the Grid''s PrepareViewStyleInfo to set the horizontal alignment. ((GridDropDownGridListControlPart)cr.ListControlPart).Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo); private void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if(e.ColIndex == 2) { e.Style.HorizontalAlignment = GridHorizontalAlignment.Right; } } DropDownSize: ------------- You can avoid the width of the dropdown getting larger by explicitly setting the width to some fixed value by handling the CurrentCellShowingDropDown. For example, setting it to the width to show all the columns. //at bottom of CurrentCellShowingDropDown..... int width = cr.ListControlPart.Grid.Model.ColWidths.GetTotal(0, cr.ListControlPart.Grid.Model.ColCount) + 16; e.Size = new Size( width, e.Size.Height); We have to address this issue. Best Regards, Jay N

Administrator [Syncfusion]
Replied On September 24, 2004 10:24 PM UTC

thanks for the quick response! got it working perfect with some minor mods: private void gridDataBoundGrid1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e) { GridControlBase grid = sender as GridControlBase; GridCurrentCell cc = grid.CurrentCell; GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer; cr.ListControlPart.Grid.SetColHidden(1, 1, true); ((GridDropDownGridListControlPart)cr.ListControlPart).Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo); int width = cr.ListControlPart.Grid.Model.ColWidths.GetTotal(1, cr.ListControlPart.Grid.Model.ColCount - 1) + 100; e.Size = new Size(width, e.Size.Height); }


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