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.

Creating controls

Thread ID:

Created:

Updated:

Platform:

Replies:

31255 Jul 4,2005 12:50 PM Jul 11,2005 03:33 AM Windows Forms 7
loading
Tags: GridControl
Pedro
Asked On July 4, 2005 12:50 PM

Hi, I downloaded the eval of your suite and i''m interested in the Grid control. Two questions. One user asked what was the difference between the Grid and the DataBoundGrid, to which was replied that the DataBoundGrid is "column based". What exactly does this mean? Second question, I placed a DataBoundGrid on a form and gave it a datasource. After it populates the entire grid, i need to have a pushbutton placed in a cell. Here''s my code GridDataBoundGrid1.DataSource = t GridDataBoundGrid1(2, 2).CellType = "PushButton" GridDataBoundGrid1(2, 2).Description = "Button" This doesn''t seem to work. The text in the cell remains the same and nothing appears. What am i doing wrong? Thanks

Administrator [Syncfusion]
Replied On July 4, 2005 02:26 PM

Column oriented means that you can set properties on columns. Our GridDataBoundGrid is column-oriented. You can set a PushButton on a column using code like; Me.GridDataBoundGrid1.Binder.InternalColumns("ColName").StyleInfo.CellType = "PushButton" //or if you have added GridBoundColumns Me.GridDataBoundGrid1.GridBoundColumns("ColName").StyleInfo.CellType = "PushButton" You cannot set cell specific properties using an indexer on a GridDataBoundGrid. If you want to set cell specific properties on a GridDataBoundGrid, you have to use an event like grid.PrepareViewStyleInfo or grid.Model.QueryCellInfo. Here is a KB link discussing this. http://www.syncfusion.com/support/kb/grid/Default.aspx Now a GridControl is a cell-oriented grid. With that grid, you can set cell specific properties using an indexer on the grid.

Pedro
Replied On July 6, 2005 03:37 AM

Mr Clay, Thank you so much for the help. Just one question, how do I databind a GridControl to a datatable? Thanks again Pedro >Column oriented means that you can set properties on columns. Our GridDataBoundGrid is column-oriented. You can set a PushButton on a column using code like; > >Me.GridDataBoundGrid1.Binder.InternalColumns("ColName").StyleInfo.CellType = "PushButton" > >//or if you have added GridBoundColumns >Me.GridDataBoundGrid1.GridBoundColumns("ColName").StyleInfo.CellType = "PushButton" > > >You cannot set cell specific properties using an indexer on a GridDataBoundGrid. If you want to set cell specific properties on a GridDataBoundGrid, you have to use an event like grid.PrepareViewStyleInfo or grid.Model.QueryCellInfo. Here is a KB link discussing this. >http://www.syncfusion.com/support/kb/grid/Default.aspx > >Now a GridControl is a cell-oriented grid. With that grid, you can set cell specific properties using an indexer on the grid. >

Administrator [Syncfusion]
Replied On July 6, 2005 04:49 AM

A GridControl normally ''holds'' its data. So, you would actually move the data from the DataTable into the grid. You can use the grid.PopulateValues method to do this for a DataTable. Another option would be to use the grid in a virtual manner. This means handling QueryCellInfo and SaveCellInfo to dynamically provide/set values from/to the DataTable. But doing this, effectively tells the grid not to store cell by cell properties for you. This means that you would lose the ability to set properties cell by cell using the indexer, and again would have to rely on events to provide cell specific properties.

Pedro
Replied On July 9, 2005 11:14 PM

Thanks for the help again. One question, in the GridDataBoundGrid I bound the grid to a datatable and i tried changing one column like this to a checkbox. It didnt work, i got an error ''index out of range.'' GridDataBoundGrid1.DataSource = objTable GridDataBoundGrid1.GridBoundColumns(1).StyleInfo.CellType = "PushButton" The grid has 3 columns What could I be doing wrong? Thanks >A GridControl normally ''holds'' its data. So, you would actually move the data from the DataTable into the grid. You can use the grid.PopulateValues method to do this for a DataTable. > >Another option would be to use the grid in a virtual manner. This means handling QueryCellInfo and SaveCellInfo to dynamically provide/set values from/to the DataTable. But doing this, effectively tells the grid not to store cell by cell properties for you. This means that you would lose the ability to set properties cell by cell using the indexer, and again would have to rely on events to provide cell specific properties.

Administrator [Syncfusion]
Replied On July 10, 2005 06:58 AM

Did you explicitly add GridBoundColumns to your GridDataBoundGrid using the designer or from code use grid.GirdBoundColumns.Add? If not, then you would not use GridDataBoundGrid1.GridBoundColumns(1).StyleInfo.CellType = "PushButton" Instead, you would use GridDataBoundGrid1.Binder.InternalColumns(1).StyleInfo.CellType = "PushButton"

Pedro
Replied On July 10, 2005 09:39 PM

Thanks, That worked :) One more question, the GridDataBoundGrid doesn''t support a cell type like a link label right? >Did you explicitly add GridBoundColumns to your GridDataBoundGrid using the designer or from code use grid.GirdBoundColumns.Add? > >If not, then you would not use > >GridDataBoundGrid1.GridBoundColumns(1).StyleInfo.CellType = "PushButton" > >Instead, you would use > >GridDataBoundGrid1.Binder.InternalColumns(1).StyleInfo.CellType = "PushButton" >

Administrator [Syncfusion]
Replied On July 11, 2005 03:33 AM

Take a look at the DerivedCellControl Tutorial that is discussed in the Essential Grid users guide. The code is found in \Syncfusion\Essential Studio\3.2.1.0\Windows\Grid.Windows\Samples\In Depth\DerivedCellControlTutorial. It derives a LinkLabel. If you add the renderer and model class code to your project, in your databound grid, if you want column 2 to be a column of links, then try: Me.gridDataBoundGrid1.Model.CellModels.Add("LinkLabel", new GridLinkLabel.LinkLabelCellModel(this.gridDataBoundGrid1.Model)) Me.gridDataBoundGrid1.Binder.InternalColumns(1).StyleInfo.CellType = "LinkLabel" You also probably want to change the line in the control code to launch the style.Text directly, instead of using style.Tag, since this will not be set by database binding. process.StartInfo.Arguments = style.Text

CONFIRMATION

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.

;