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.
Syncfusion Feedback

Overriding doesn''t work with previous Cntl+Enter solution (virtual grid)

Thread ID:

Created:

Updated:

Platform:

Replies:

43686 Apr 30,2006 10:06 PM UTC May 1,2006 05:57 PM UTC Windows Forms 2
loading
Tags: GridControl
Adam K.
Asked On April 30, 2006 10:06 PM UTC

I am using a virtual grid with Sync version 3.3. I have the Cntl+Enter working so when i highlight a group of cells in a column, type in a value and hit Cntl+Enter, I capture the CurrentCellKeyDown event and all of the cells get filled in with the same value and the SaveCellinfo fires appropriately. This was to replicate excel behavior (code below) Original request was listed on the below link: http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=42922 But i have one use case that is NOT working. I sometimes capture the CurrentCellValidating to translate what the user typed in an override its value. Here is an example below for single cell user edit: 1. User types in ''NY'' into a cell 2. I capture this in CurrentCellValidating and change it to ''New York'' 3. This code updates the value so SaveCellInfo has ''New York'' in e.Style.CellValue _HPGrid.CurrentCell.Renderer.Control.Text = c.OverrideVal.ToString(); I am UNABLE to get this to work with the Cntl+Enter functionality. The above code overrides the value so when the SaveCellInfo fires, it is the correct full word in e.Style.CellValue. The issue is that this is not happening using the Cntrl+Enter solution. In the code below, when i hit control enter, the SaveCellInfo fires but CurrentCellValidating DOES NOT fire. Because of this i dont get a chance to check for this validation and override the users value and then populate the full range with that new word. So the Cntrl+Enter works but only if there is no translation that i need to override using CurrentCellValidating. Here is current code path for Cntl+Enter functionality 1. User highlights multiple cells in column 2. User types in ''NY'' and hits Cntl+Enter 3. I detect the Cntl+Enter in CntrCurrentCellKeyDown and call the following code to populate the full highlighted range if ((e.KeyCode == Keys.Enter)&&(Control.ModifierKeys & Keys.Control)!=0) { GridCurrentCell cc = _HPGrid.CurrentCell; GridRangeInfo info = _HPGrid.Selections.Ranges.ActiveRange; if (info.Top != info.Bottom) { for(int i = info.Top; i<=info.Bottom ;i++) _HPGrid[i,info.Left].CellValue = cc.Renderer.ControlText; _HPGrid.RefreshRange(GridRangeInfo.Rows(info.Top, info.Bottom)); e.Handled = true; _HPGrid.CurrentCell.EndEdit(); } NOTE: At this point i would like all cells in the highlighted range to show ''New York'' (the translated value) but it simply doesn''t work. Please let me know if you have any suggestions or workarounds (samples would be great) to get this behavior to work where the override translation working in "Cntl+Enter" mode. thks, ak

Administrator [Syncfusion]
Replied On May 1, 2006 05:49 AM UTC

Hi Adam, In the CurrentCellKeyDown event handler before populating the current cell value in the selected range, call the CurrentCell.EndEdit(); which will trigger the CurrentCellValidating event. Below is a code snippet. if ((e.KeyCode == Keys.Enter)&&(Control.ModifierKeys & Keys.Control)!=0) { GridCurrentCell cc = _HPGrid.CurrentCell; cc.EndEdit(); GridRangeInfo info = _HPGrid.Selections.Ranges.ActiveRange; if (info.Top != info.Bottom) { for(int i = info.Top; i<=info.Bottom ;i++) _HPGrid[i,info.Left].CellValue = cc.Renderer.ControlText; //_HPGrid.RefreshRange(GridRangeInfo.Rows(info.Top, info.Bottom)); //e.Handled = true; //_HPGrid.CurrentCell.EndEdit(); } } Regards, Calvin.

Adam K.
Replied On May 1, 2006 05:57 PM UTC

worked like a charm . .thank you very much . . >Hi Adam, > >In the CurrentCellKeyDown event handler before populating the current cell value in the selected range, call the CurrentCell.EndEdit(); which will trigger the CurrentCellValidating event. Below is a code snippet. > >if ((e.KeyCode == Keys.Enter)&&(Control.ModifierKeys & Keys.Control)!=0) > { > GridCurrentCell cc = _HPGrid.CurrentCell; > cc.EndEdit(); > GridRangeInfo info = _HPGrid.Selections.Ranges.ActiveRange; > if (info.Top != info.Bottom) > { > for(int i = info.Top; i<=info.Bottom ;i++) > _HPGrid[i,info.Left].CellValue = cc.Renderer.ControlText; > > //_HPGrid.RefreshRange(GridRangeInfo.Rows(info.Top, info.Bottom)); > //e.Handled = true; > //_HPGrid.CurrentCell.EndEdit(); > } > } > >Regards, >Calvin.

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.

Warning Icon 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.Close Icon

;