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

Creating controls

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

7 Replies

AD Administrator Syncfusion Team July 4, 2005 01: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.


PE Pedro July 6, 2005 02: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. >


AD Administrator Syncfusion Team July 6, 2005 03: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.


PE Pedro July 9, 2005 10: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.


AD Administrator Syncfusion Team July 10, 2005 05: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"


PE Pedro July 10, 2005 08: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" >


AD Administrator Syncfusion Team July 11, 2005 02: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

Loader.
Live Chat Icon For mobile
Up arrow icon