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

Read Only Columns in GDBG

Hi, What would be the generic code to make all the columns of a GDBG read-only with these condions? It should not effect scroll bras. Grid may have gridboundcolumns or may not? Grid may be a flat grid or a hierarchical view? Thanks,

4 Replies

AD Administrator Syncfusion Team November 18, 2005 07:05 PM UTC

Code should notbe in grid event? because i am trying to write a generic code. Thansk,


AD Administrator Syncfusion Team November 18, 2005 11:42 PM UTC

Here is some code you can try. //for a flat grid GridBoundColumnsCollection gbcc = (grid.GridBoundColumns == null || grid.GridBoundColumns.Count == 0) ? grid.Binder.InternalColumns : grid.GridBoundColumns; gbcc["colname"].StyleInfo.ReadOnly = true; //for a hierarchical grid GridHierarchyLevel level = this.gridDataBoundGrid1.Binder.GetHierarchyLevel(someLevel); GridBoundColumnsCollection gbcc = (level.GridBoundColumns == null || level.GridBoundColumns.Count == 0) ? level.InternalColumns : level.GridBoundColumns; gbcc["colname"].StyleInfo.ReadOnly = true;


AD Administrator Syncfusion Team November 20, 2005 06:25 AM UTC

Clay, How do i know wether a grid is flat or a hierarchical grid? if it is a hierarchical grid, I want to ge the Max Columns count at any level, i mean i need to get the columns cout of a level which has max # of columns. Thanks,


AD Administrator Syncfusion Team November 20, 2005 10:05 AM UTC

Try: this.gridDataBoundGrid1.Binder.HierarchyLevelCount Loop through the hierarchylevels for the grid, and get the max of gbcc.Count for each level. (Here gbcc is from the code snippet in the last post.)

Loader.
Live Chat Icon For mobile
Up arrow icon