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.
I am utilizing a GridGroupingControl which is bound to an ArrayList of custom objects. In addition to setting the data source of the grid, I am specifying different properties to modify the appearance and behavior of the grid.
One of the items I am (attempting to) modify is the cell type of the record cells. Because the grid is intended to be read-only, I would like to conver the cell types from the default rendered cell types (i.e. textboxes, checkboxes, etc.) to a cell type of "Static".
I am using the following code.
ArrayList list = this.GetSampleData(); this.grdPrimary.DataSource = list;
// turn off the "add new record" row this.grdPrimary.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails=false; this.grdPrimary.TopLevelGroupOptions.ShowAddNewRecordAfterDetails=false; this.grdPrimary.ChildGroupOptions.ShowAddNewRecordBeforeDetails=false; this.grdPrimary.ChildGroupOptions.ShowAddNewRecordAfterDetails=false;
// make the entire grid read-only, single row selection, other items this.grdPrimary.Appearance.AnyCell.ReadOnly=true; this.grdPrimary.TableOptions.ListBoxSelectionMode=SelectionMode.One; this.grdPrimary.Appearance.RecordFieldCell.CellAppearance=GridCellAppearance.Flat; this.grdPrimary.Appearance.AnyRecordFieldCell.CellType="Static"; this.grdPrimary.Appearance.AnyRecordFieldCell.ReadOnly=true;
// get rid of the unnecessary header items this.grdPrimary.TableOptions.ShowRowHeader=false; this.grdPrimary.TopLevelGroupOptions.ShowCaption=false;
There are no unhandled exceptions being generated, and the other items process as expected. For instance, even though the "Static" cell type is not being applied, I cannot modify any values in the grid due to the "read-only=true" being specified.
Can you tell me what might be causing the GridGroupingControl to ignore the call to set all Record Field Cells to ''CellType="Static"'' and rendering as the default editor controls?
ADAdministrator Syncfusion Team August 22, 2006 05:11 AM UTC
Hi John,
By Default, the Static CellType will display text that cannot be edited. You can select it to make it the current cell but, the cell cannot be activated for editing. Static cells can be deleted by the user if the static cells are part of the selection when the delete key is pressed. (To prevent this deletion behavior, set static cells to Read-only.) Static cells may also include an image in addition to the text. Try the below code snippet.
Here is a sample. http://www.syncfusion.com/Support/user/uploads/GGCArrayList_f06c2b68.zip
Let me know if this helps. Best Regards, Haneef
JPJohn PattersonAugust 22, 2006 12:55 PM UTC
Hi Haneef,
That seems to resolve my issue. Thanks for your help!
>Hi John,
By Default, the Static CellType will display text that cannot be edited. You can select it to make it the current cell but, the cell cannot be activated for editing. Static cells can be deleted by the user if the static cells are part of the selection when the delete key is pressed. (To prevent this deletion behavior, set static cells to Read-only.) Static cells may also include an image in addition to the text. Try the below code snippet.