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

DataBoundGrid Editable Columns

How do I make all but one the columns in a DataBoundGrid editable? Right now I can only seem to make it all or nothing.

3 Replies

AD Administrator Syncfusion Team July 30, 2003 08:52 PM UTC

For the column, you can set the style.ReadOnly = true and/or style.CellType = "Static". To set the column style, you use the grid.GridBoundColumns if you have explicitly added them, or you use the grid.Binder.InternalColumns if you have not explicilty added GridBoundColumns, grid.Binder.InternalColumns[2].StyleInfo.ReadOnly = true; grid.Binder.InternalColumns[2].StyleInfo.CellType = "Static";


SA scot adams July 31, 2003 02:08 PM UTC

and if I had boundgrid with realations (e.g. Customers and Orders) displaying using something similar to this GridHierarchyLevel childrenLevel = this.grid.Binder.AddRelation("CustomerOrders");, how would I set specific rows in the child table as uneditable? Also, if I have something like a checkbox in the child level row, how do I read the value? Using the format grid[row,col] will only read the value if the child row is expanded and visible.


AD Administrator Syncfusion Team July 31, 2003 03:23 PM UTC

The last request is trickier than the first. The problem is that currently the grid knows only what is being displayed. So, if there is a child list that is not expanded, the grid has no direct knowledge of it until the node is expanded and the data is retrieved from the relation. So, if you have hidden information, then I think you would have to work directly with the dataset\tables\relations involved to retrieve what you want. As far as making a particular row readonly, you can handle this because it only matters when the row is visible, and at that point, the grid does have knowledge of it. To do this, you would handle the grid.model.QueryCellInfo event. In teh event, you would use e.RowIndex, and get its GridBoundRecordState. From the GridBoundrecordState, you have information about the parent list, the hierarchylevel, and this row's position in the parent table. So, somehow, check to see if this row is a row you want to be readonly, and if so, set e.Style.ReadOnly = true.

Loader.
Up arrow icon