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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Read Only Columns in GDBG

Thread ID:





37302 Nov 18,2005 07:04 PM UTC Nov 20,2005 10:05 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On November 18, 2005 07:04 PM UTC

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,

Administrator [Syncfusion]
Replied On November 18, 2005 07:05 PM UTC

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

Administrator [Syncfusion]
Replied On 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;

Administrator [Syncfusion]
Replied On 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,

Administrator [Syncfusion]
Replied On 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.)


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon