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

GridDataBound

Hi 1.How can i control what the grid has to display in DBGrid ? When my datasource changes, what is refreshed ? All the data or only the data in the client area ? can i control this ? 2.How do i control the style of the cells dynamically in the DBGrid. Can i do it on a per cell basis ? 3.When i sort the grid, does it means that my dataource has been sorted or only the grid ? Then where the mapping fits in this picture ? I feel like it''s very complicated to navigate in the maze of the Syncfusion controls. One reason i want the DBGrid is because there is already the filter bar, the sort... which is not the case in the simple control... Thanks Kevin

5 Replies

AD Administrator Syncfusion Team February 7, 2005 01:10 PM UTC

Also about the formulas. Which grid hold this features ? Can a DBGrid have a calculated colum ?


AD Administrator Syncfusion Team February 7, 2005 01:25 PM UTC

1) To control the columns that are displayed in the GriddataBoundGrid, add GridBoundColumns to to grid.GridBoundColumns collection. For each GridBoundColumn, make sure you set the gridBoundColumn.MappingName to specify the column you want to use, and add them in the order you want to see them. The GridDataBoundGrid does not actually ''hold'' any data, it justs reflects what is in your datasource. So, you will only see the visible changes done to your datasource, but when other parts of the datasource are exposed in the grid, they will appear updated at that time. 2) You can set columns styles using GridBoundColumn.StyleInfo. To set styles cell by cell in a GridDataBoundGrid, you must use PrepareViewStyleInfo or Model.QueryCellInfo. Browse the GrirDataBoundGrid section of our KB. There are artilces on setting column properties and cell preoperties there. 3) The Sortting is done through the ADO.NET DataView associated with your datasource (or throught IBindingList sort support if you are not using a DataTable). The DataTable is not sorted. The sort information is maintained in the DataView. 4) To use formulas in a GridDataBoundGrid, the simplest thing is to add a DataColumn to your DataTable and set its Expression property. See the .NET Framework help on DataColumn.Expression for the types of things this can do for you.


AD Administrator Syncfusion Team February 7, 2005 02:07 PM UTC

Thanks Clay for the info I''m basically trying to choose the right grid and things are really not clear. You should have a better doc...althought the support is great ! Another question : how different the GroupingGrid is different from the DBGrid ?


AD Administrator Syncfusion Team February 7, 2005 02:24 PM UTC

Clay I saw a sample code about blinking cells. But it works only for simple grid. How difficult would it be to customize it for the DBGrid?


AD Administrator Syncfusion Team February 7, 2005 05:58 PM UTC

You have to use PrepareViewStyleInfo to set style properties on individual cells in a GridDataBoundGrid. See this KB. http://www.syncfusion.com/Support/article.aspx?id=560 If you want grouping support, you need to use the GridGroupingControl as GridDataBoundGrid does not support grouping. GridControl is a cell oriented grid that allows you to set styles on a cell by cell, row by row, column by column basis. You can also use it in a virtual mode that allows it to hold not data, dynamically getting its data through events that you handle to provide the data. GridDataBoundGrid is a column oriented grid that needs to have a datasource set. It is the closest control to a Windows Forms DataGrid. It can display hierarchical data. But it cannot be grouped. GridGroupingControl allows you to group a Datasource. It allows for summaries (both built-in and custom), and true nested tables. It also allows formatting of rows using conditional formats, something that would require handling an event in a GridDataBoundGrid.

Loader.
Live Chat Icon For mobile
Up arrow icon