What is the recommended way if a user types in a piece of data and i am catching it on SaveCellInfo and i want to discard it and put back the old value that was previously there.
If i just return it seems to keep the value until i put my mouse over the cell and then it returns to the old value. (because QueryCellInfo gets fired again)
I then thought to force a refresh in the SaveCellInfo callstack. Do i need to force a refresh on the cell to have querycellInfo get called.
Is forcing a refresh on the callstack of SaveCellInfo dangerous.
thks,
ak
AD
Administrator
Syncfusion Team
December 9, 2005 02:49 PM UTC
Usually, user input validation is done by handling the grid.CurrentCellValidating event. There, you can get the proposed value using grid.CurrentCell.Renderer.ControlText, and if it is not valid, set e.Cancel = true. This is raised before SaveCellInfo.
AK
Adam K.
December 9, 2005 03:10 PM UTC
this event doesn''t give you a rowIndex and a colIndex like the SaveCellInfo.. how do i figure out this info ??
thks,
ak
>Usually, user input validation is done by handling the grid.CurrentCellValidating event. There, you can get the proposed value using grid.CurrentCell.Renderer.ControlText, and if it is not valid, set e.Cancel = true. This is raised before SaveCellInfo.
AD
Administrator
Syncfusion Team
December 9, 2005 03:41 PM UTC
grid.CurrentCell.RowIndex and grid.CurrentCell.Colindex.
AK
Adam K.
December 9, 2005 03:55 PM UTC
Of course . .Ok i an now listening to this new event. Here is a follow up question.
I have a scenario where i check the value in the CellValidating event callstack and i want to change it before i send it to the SaveCellInfo event. For example, if someone types in an abbreviation, i have mapping code to change the value (I was previously doing this in the SaveCellInfo event) but now that i have to move this to the CellValidation event to detect bad inputs, i need a way to update the entered value and pass it to the savecellinfo event.
Any ideas?
thks,
ak
>grid.CurrentCell.RowIndex and grid.CurrentCell.Colindex.
AD
Administrator
Syncfusion Team
December 9, 2005 03:59 PM UTC
In CurrentCellValidating, if you want to change teh string that will appear in the cell, you can set:
grid.CurrentCell.Renderer.Control.Text
Notice this is a difference property than the one that gave the proposed value.
AK
Adam K.
December 9, 2005 04:16 PM UTC
perfect . .
>In CurrentCellValidating, if you want to change teh string that will appear in the cell, you can set:
>
>grid.CurrentCell.Renderer.Control.Text
>
>Notice this is a difference property than the one that gave the proposed value.
AK
Adam K.
December 9, 2005 11:13 PM UTC
if you change the
grid.CurrentCell.Renderer.Control.Text
in the
CurrentCellValidating event
to the new value, the cursor goes to the front of the cell. this is normally not noticable but if the SaveCellInfo event has an expensive operation then it
Is there anyway to keep it at the end where it should logically stay. This is easily reproducable in your example if you add a SaveCellInfo event and do something in a long loop.
thks,
ak
>perfect . .
>
>>In CurrentCellValidating, if you want to change teh string that will appear in the cell, you can set:
>>
>>grid.CurrentCell.Renderer.Control.Text
>>
>>Notice this is a difference property than the one that gave the proposed value.
AD
Administrator
Syncfusion Team
December 10, 2005 12:22 AM UTC
After setting the value in Control.Text within CurrentCellValidating, try setting the cursor position.
GridTextBoxControl tb = this.gridControl1.CurrentCell.Renderer.Control as GridTextBoxControl;
tb.SelectionLength = 0;
tb.SelectionStart = tb.TextLength;
tb.Refresh();
AK
Adam K.
December 10, 2005 04:14 PM UTC
thks . .
>After setting the value in Control.Text within CurrentCellValidating, try setting the cursor position.
>
>GridTextBoxControl tb = this.gridControl1.CurrentCell.Renderer.Control as GridTextBoxControl;
>tb.SelectionLength = 0;
>tb.SelectionStart = tb.TextLength;
>tb.Refresh();
>