locked
How to programatically Discard Screen changes? RRS feed

  • Question

  • How do we programatically Discard Screen changes from within the Saving() event?

    In other words, accomplish the same result as the user clicking the Discard button.

     

    Wednesday, February 2, 2011 4:54 PM

Answers

  • Hi Garth, would something like this work?

    partial void ProductDetail_Saving(ref bool handled)
    {
      // Write your code here.
      this.DataWorkspace.ApplicationData.Details.DiscardChanges();
      handled = true;
    }
    
    

     

     

    Wednesday, February 2, 2011 5:37 PM

All replies

  • Hi Garth, would something like this work?

    partial void ProductDetail_Saving(ref bool handled)
    {
      // Write your code here.
      this.DataWorkspace.ApplicationData.Details.DiscardChanges();
      handled = true;
    }
    
    

     

     

    Wednesday, February 2, 2011 5:37 PM
  • You can also discard at more granular level (for example: just the changes to a specific entity). See the "Working with Change Sets" section of the following MSDN topic - http://msdn.microsoft.com/en-us/library/ff851990.aspx.
    Norm Estabrook
    Wednesday, February 2, 2011 8:41 PM