views:

791

answers:

2

I looked at http://msdn.microsoft.com/en-us/library/7tas5c80.aspx for reference and it makes sense as far as editable column goes.

The question is how do I host a "view only" custom control in a DataGridView (WinForm and C#)?

A: 

Derive from DataGridViewCell and override the Paint methods.

hjb417
A: 

Another easy way would be to make that column one of the "DataKeyNames" columns of the grid. Any field that is considered a "Key" is by default disabled from a user editing it. However, if you deal with object analysis on "clicked" on records for editing, or other, the array of returned keys will be in the same sequence as they are listed in the DataKeyNames property. So, even though you may be ignoring the actual value as a "Key", it can act to disable it.

HTH

DRapp