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. Image for the cookie policy date
close icon

GDBG and readonly cell

HI, I am using following code: DataColumn colName = new DataColumn("Name"); DataColumn colComment = new DataColumn("Comment"); DataTable myTable = new DataTable("MyTable"); myTable.Columns.Add(colComment); grid.DataSource = myTable; I cannot edit the cells. How to make the Comment column editable. Thanks, Michael

3 Replies

AD Administrator Syncfusion Team October 10, 2005 07:59 AM UTC

If I drop a GridDataBoundGrid on a form and add your code to the forms''s Load event handler, I do not have a problem adding new rows. Here is what I tried. http://www.syncfusion.com/Support/user/uploads/GdbG_Simple_3b5a63b6.zip Search your code for ReadOnly settings, AllowEdit settings, and AllowAddNew settings to see if you have some property set that might be interferring with this behavior. If you can upload a sample showing the problem we can try to spot something here.


MC Michael Cruanes October 11, 2005 09:41 AM UTC

Sorry Clay, My problem was not well formulated. I want the whole grid not editable but only the Comment column should be editable. What is the best way to do that ?


AD Administrator Syncfusion Team October 11, 2005 10:05 AM UTC

If you want to do it through property setting, then you can set the GridBoundColumn.StyleInfo.ReadOnly = true for all columns you want to be readonly. If you are not explicitly adding GridBoundColumns, then you set this property in the grid.Binder.InternalColumns collection. If you are adding GridBoundColumns, then you set this property using the grid.GridBoundColumns collection. Or you can use the grid.Model.QueryCellInfo event. there if e.ColIndex does not point to your comment column and e.RowIndex > 0, then set e.Style.ReadOnly = true.

Loader.
Live Chat Icon For mobile
Up arrow icon