• North American Sales: 1-800-231-8588
  • Global Contacts
  • My Account
Infragistics Infragistics
Menu
  • North American Sales: 1-800-321-8588
  • My Account
    • Sign In/Register
  • Design & DevelopmentDesign & Develop
    • Best Value
      Infragistics Ultimate The complete toolkit for building high performing web, mobile and desktop apps.
      Indigo.Design Use a unified platform for visual design, UX prototyping, code generation and application development.
    • Web
      Ignite UI for Angular Ignite UI for JavaScript Ignite UI for React Ultimate UI for ASP.NET Indigo.Design
    • Desktop
      Ultimate UI for Windows Forms Ultimate UI for WPF
      Prototyping
      Indigo.Design
    • Mobile
      Ultimate UI for Xamarin Ultimate UI for iOS Ultimate UI for Android
    • Automated Testing Tools
      Test Automation for Micro Focus UFT: Windows Forms Test Automation for Micro Focus UFT: WPF Test Automation for IBM RFT: Windows Forms
  • UX
    • Indigo.Design Desktop Collaborative prototyping and remote usability testing for UX & usability professionals
    • Indigo.Design A Unified Platform for Visual Design, UX Prototyping, Code Generation, and App Development
  • Business Intelligence
    • Reveal Embedded Accelerate your time to market with powerful, beautiful dashboards into your apps
    • Reveal App Empower everyone in your organization to use data to make smarter business decisions
  • Team Productivity
  • Learn & Support Support
    • Help & Support Documents
    • Blogs
    • Forums
    • Product Ideas
    • Reference Applications
    • Customer Stories
    • Webinars
    • eBook & Whitepapers
    • Events
  • Free Trials
  • Pricing
    • Product Pricing / Buy Online
    • Renew Existing License
    • Contact Us
Windows Forms
  • Product Platforms
  • More
Windows Forms
Windows Forms Disable WinGrid Row, Cell or Column with Activation Object
  • Blog
  • Files
  • Wiki
  • Members
  • Mentions
  • Tags
  • More
  • Cancel
  • New
Windows Forms requires membership for participation - click to join
  • Windows Forms
  • Best Practices for Placing a DropDown or Combo in an WinGrid Cell
  • Change Color of Column Headers in WinGrid
  • Disable WinGrid Row, Cell or Column with Activation Object
  • Performance in the WinTilePanel
  • Select All Rows in WinGrid Programatically
  • UI Thread Marshaling in the Model Layer
  • Using an WinGrid DataFilter to Convert Strings to Bools (and vice-versa) for a Checkbox Column

Disable WinGrid Row, Cell or Column with Activation Object

It is sometimes necessary to make a column which is editable in the underlying data read-only or disabled in the grid.  This can be done by changing the Activation on several levels of objects.

To disable editing in the entire grid or on a Band-level, use the AllowUpdate property on the override. There is an Override property on the grid's DisplayLayout and on the band, so you can disable editing on the entire grid via the DisplayLayout.Override and then override the DisplayLayout setting on any individual band.

C#

// Disable updating on the entire grid
this.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False; 

// Enable updating on the root band. This will override the displayLayout setting
this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;

VB

' Disable updating on the entire grid
Me.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False 

' Enable updating on the root band. This will override the DisplayLayout setting
Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowUpdate = DefaultableBoolean.False

To affect an entire column, use the CellActivation Property on the column.

C#

// Disable the first column in the first band
this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellActivation = Activation.Disabled;

VB

' Disable the first column in the first band
Me.ultraGrid1.DisplayLayout.Bands(0).Columns(0).CellActivation = Activation.Disabled

To affect an entire row, use the Activation property of the row.

C#

// Disable the first row in the grid
this.ultraGrid1.Rows[0].Activation = Activation.Disabled;

VB

' Disable the first row in the grid
Me.ultraGrid1.Rows(0).Activation = Activation.Disabled

To affect individual Cells, set the Activation property on the Cell.

C#

// Disable the first cell in the grid
this.ultraGrid1.Rows[0].Cells[0].Activation = Activation.Disabled;

VB

' Disable the first cell in the grid
Me.ultraGrid1.Rows(0).Cells(0).Activation = Activation.Disabled

When using CellActivation or Activation, a Cell will always take on the least accesible Activation level based on it's Row, Column, and Cell Settings. For example, if the Row is Disabled, the Activation settings of the Column and Cell will be ignored.
If it is necessary to allow editing in a single Cell whose column or row is otherwise disabled or Read-only, the cell can be forced to honor it's own Activation Property by setting the IgnoreRowColActivation property on the cell to true.

Note that updating and deleting are separate properties. To prevent rows from being deleted, use the AllowDelete property on the override.

C#

// Disable deleting on the entire grid
this.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False; 

// Enable deleting on the root band. This will override the displayLayout setting
this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowDelete = DefaultableBoolean.False;

VB

' Disable deleting on the entire grid
this.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False 

' Enable deleting on the root band. This will override the DisplayLayout setting
Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowDelete = DefaultableBoolean.False
  • WinGrid
  • Share
  • History
  • More
  • Cancel
Related
Recommended