The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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,
ADAdministrator 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,
ADAdministrator 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;
ADAdministrator 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,
ADAdministrator 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.)