Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
UltraGrid ActiveCell Value problem
posted

Hi,

am using an ultragrid and an ultratoolbar which has a save button

in my grid i have amount column and date column.and i can save only when date n amount , both fields are entered.

If the user enters amount and leaves the date field as blank then it should give alert that date filed cannot be empty and vicecersa.

i have written the validation in UltraGrid_BeforeRowUpdate

which is wrking for me

but my problem is when i enter amount as 100 and click  on save button on toolbar,BeforeRowUpdate event is getting fired but when i see the Activecell value it is showing the previous value but not  newly enteres value 100 but theActiveCell text is 100.

so how can i get the value as 100???

 

please help me out soon its very urgent for me

 

thanks

Priyanka

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    When you click a toolbar button it does not take the cell out of edit mode, and when a cell is in edit mode, the current value is not reflected in its Value property but rather that of the associated embeddable editor. The following code sample demonstrates how to get that value:

    private void ultraGrid_BeforeRowUpdate(object sender, CancelableRowEventArgs e)
    {
        UltraGrid control = sender as UltraGrid;
        UltraGridCell activeCell = control.ActiveCell;
        EmbeddableEditorBase editor = activeCell != null ? activeCell.EditorResolved : null;
        object currentCellValue = editor != null && editor.IsInEditMode ?
            editor.IsValid ? editor.Value : editor.CurrentEditText :
            activeCell.Value;
    }

Children
No Data