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

How to control column names in GridListControl?

Thread ID:





2068 Dec 12,2002 03:43 PM Dec 12,2002 04:56 PM Windows Forms 1
Tags: GridControl
Sean Greer
Asked On December 12, 2002 03:43 PM

This should be an easy one: how can I control the number of columns and the column heading within a GridListControl? I'm setting the DataSource to a DataView, but I only want to show a subset of the columns. Also, does the GridListControl provide keyboard functionality similar to the ListView? What I want is for the GridListControl to select the appropriate item as I type. Thanks, Sean

Administrator [Syncfusion]
Replied On December 12, 2002 04:56 PM

Sean, To hide columns in a GridListControl, you access the embedded GridControl property, GridListControl.Grid. Dim grid As GridControl = Me.GridListControl1.Grid grid.Cols.Hidden(3) = True ' hide col 3 To change the column headers takes more work if you want to do it in the GridListControl. You can change it by changing the ColumnName in the datatable with code such as: Me.DataSet11.Products.ProductIDColumn.ColumnName = "zzzzzzz" But if you want to change in from within the GridListControl, you currently have to handle the GridListControl.Grid.PrepareViewStyleInfo event and provide the header there. 'add the handler Dim grid As GridControl = Me.GridListControl1.Grid AddHandler grid.PrepareViewStyleInfo, AddressOf GridPrepareViewStyleInfo 'the handler Private Sub GridPrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs) If e.RowIndex = 0 And e.ColIndex = 2 Then e.Style.Text = "MyCOl2Name" End If You can see an auto-complete GridListControl in a grid cell in the Quick Start/CellTypes sample that ships with the product. (Go to the bottom of the 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.

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.