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
3160
How to force RecordUpdating to be called?
posted

I have seen this post however it does not work the way I need it too:

http://forums.infragistics.com/forums/t/3547.aspx

We want the user to be able to click the plus button and save the current record even if the current record is the add record and the data has not changed.  The way it works now,

Grid.ExecuteCommand(

 

DataPresenterCommands.CommitChangesToActiveRecord);

does not call RecordUpdating to be called if the data in the add record has not changed.

Thanks very much,

 

Sam 

 

  • 35319
    Verified Answer
    posted

    Hello Sam,

     

    I have been looking into your post and it seems that using :

     

    xamDataGrid1.ExecuteCommand(DataPresenterCommands.CommitChangesToActiveRecord);

     

    fires the  ‘RecordUpdating’ event. I have managed to achieved the functionality that you are looking for by handling the event ‘MouseLeftButtonDown’ of the icons which form the plus icon :

     

    <Style TargetType="igDP:DataRecordPresenter">

                <EventSetter Event="Loaded" Handler="LoadEvent"/>

            </Style>

     

     

    void LoadEvent(object sender, RoutedEventArgs e)

            {

                if ((sender as DataRecordPresenter).IsAddRecord == true)

                {

                    Utilities.GetDescendantFromName(sender as DependencyObject, "icons").MouseLeftButtonDown += new MouseButtonEventHandler(MainWindow_MouseLeftButtonDown);

                }

            }

     

            void MainWindow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

            {

                xamDataGrid1.ExecuteCommand(DataPresenterCommands.CommitChangesToActiveRecord);

            }

     

    You can also look through the following forum thread in which it is suggested another approach on how to be achieved this functionality:

     

     http://forums.infragistics.com/forums/t/44842.aspx

     

    If you need any further assistance on this matter, feel free to ask.