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.
Unfortunately, activation email could not send to your email. Please try again.

Selective column edit enabling in a GDBG

Thread ID:

Created:

Updated:

Platform:

Replies:

8133 Oct 22,2003 11:27 AM Oct 23,2003 01:46 PM Windows Forms 7
loading
Tags: GridControl
Doug Lind
Asked On October 22, 2003 11:27 AM

Hi, I have some grids where I want to enable editing on a few columns. The easiest approach seems to be make the grid readonly and selectively enable the columns. In going through the docs I see that styles are evaluated from a higher level (grid) to a lower level (cell). Does this also apply when dealing with readonly property? Also, what is the difference between readonly and enableEdit? Also, also, the values in some of the columns are dependent upon values in the editable ones. It looks like readonly also prevents dynamic updates of cells. If I set ignoreReadonly on on columns requiring dynamic updates, will that continue to prevent user updates to the column? Thanks, Doug Lind

Administrator [Syncfusion]
Replied On October 22, 2003 11:39 AM

To make the whole grid readonly except for a few columns, first for each column that you want to be able to edit, set gridBoundColumn.StyleInfo.ReadOnly = false; After that (and after you have set any other style properties you want to set), set grid.TableStyle.ReadOnly = true;. This will effectively set everything readonly except the columns explicitly set to ReadOnly = false. grid.EnableEdit = false is another way to make the whole grid un-editable. It mimics the properties of the standard DataView class with its AllowEdit and AllowAddNew, etc. If you set IgnoreReadOnly to true, make your programatic changes, and then immediately set it back to false, then your user should not be able to make changes to your readonly cells.

Doug Lind
Replied On October 22, 2003 02:27 PM

Thanks for the help, it works well. Now, what event should I be using in a GDBG to capture when a user changes cell data? I looked at CellChanged but it seems to be specific for the grid control, and I don't see anything similar for a GDBG. BTW Does changing a cell value auto-magically update the datasource by default? If not, can you point me to an appropriate example? Thanks again Doug

Administrator [Syncfusion]
Replied On October 22, 2003 05:25 PM

The CurrentCellChanged event is available in a GridDataBoundGrid. Changes to a single row are cached until the user leaves the row, and at that point is when the changes are saved to the datasource. You can flush any pending changes with code like grid.Binder.EndEdit(). (If you are uses ADO.NET and a dataadapter, then you will also have to call dataadapter.Update to flush the changes cached by ADO.NET back to the actual datasource.)

Doug Lind
Replied On October 23, 2003 09:24 AM

Great Clay, Now I need to retrieve the cached value so it can be used to update another column. I don't want to wait for a rowchange event plus I'd lose which cell was updated. Maybe you know of a better way. Basically I just want to update one column from another when the source column is changed. Not after they leave the row. BTW Do I need to update both the cell value and text, or is the value alone sufficient?

Administrator [Syncfusion]
Replied On October 23, 2003 10:04 AM

I would do this in the CurrentCellAccepted event. private void gridDataBoundGrid1_CurrentCellAcceptedChanges(object sender, CancelEventArgs e) { GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; Console.WriteLine(this.gridDataBoundGrid1[cc.RowIndex, cc.ColIndex].Text); } CellValue alone is sufficient to set a cell's value.

Doug Lind
Replied On October 23, 2003 01:20 PM

Hey Clay, Sorry to keep bugging you but I'm overwhelmed by all the events you have. What I need is to trigger a display update when a GDBG row selection changes. For my purposes, this means when the arrow in the far left column changes position. I don't want the whole range, just the row with the arrow. I see that GDBG.model has SelectionChanged event but can't get a handler to hookup with it. Even if it did, how would I determine which row has the arrow? Thanks, Doug Lind

Administrator [Syncfusion]
Replied On October 23, 2003 01:46 PM

There are RowLeave and RowEnter events you might be able to use. There is also a CurrentCellMoved event. In that event, you can check grid.CurrentCell.MoveToRowIndex and grid.CurrentCell.MoveFromRowIndex to see if you have changed rows, and there you know both the new and old row.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;