﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Clarifying expected behaviour when editing related data in a grid</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 24 Sep 2026 03:43:30 GMT</lastBuildDate><ttl>20</ttl><item><title>Clarifying expected behaviour when editing related data in a grid</title><link>http://forum.strataframe.net/FindPost11766.aspx</link><description>I have a maintenance form to modify a business object. The form also has a grid containing related child data which is wired up using binding etc.&lt;/P&gt;&lt;P&gt;All seems to work as expected apart from when editing values in the grid (the "child" records) the form's tool strip&amp;nbsp;does not go into "edit mode". How can I get the MFTS to react to the child records in the grid / BO?&lt;/P&gt;&lt;P&gt;Also, for clarification: assuming I can get this working, what would the Undo button do to the child records? Would it undo all changes if I had changed multiple child record values in the grid or just the last row changed? I'm hoping the former...&lt;/P&gt;&lt;P&gt;Thanks in advance</description><pubDate>Mon, 08 Oct 2007 08:34:02 GMT</pubDate><dc:creator>thegwill</dc:creator></item><item><title>RE: Clarifying expected behaviour when editing related data in a grid</title><link>http://forum.strataframe.net/FindPost11902.aspx</link><description>Yep, that would work, too.&amp;nbsp; I think the SetEditingState() was changed from Friend (internal) to public recently, and it might not be in the latest release, so calling Edit() would work just as well.</description><pubDate>Mon, 08 Oct 2007 08:34:02 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Clarifying expected behaviour when editing related data in a grid</title><link>http://forum.strataframe.net/FindPost11894.aspx</link><description>...and there's no .SetEditingState() method and the .EditingState property is read only&lt;P&gt;How about I call .Edit() with the same effect:&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;if&lt;/FONT&gt; (childBO.IsDirty &amp;amp;&amp;amp; parentBO.EditingState == &lt;FONT color=#2b91af&gt;BusinessEditingState&lt;/FONT&gt;.Idle)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; parentBO.Edit();</description><pubDate>Sat, 06 Oct 2007 03:11:28 GMT</pubDate><dc:creator>thegwill</dc:creator></item><item><title>RE: Clarifying expected behaviour when editing related data in a grid</title><link>http://forum.strataframe.net/FindPost11893.aspx</link><description>Thanks Ben&lt;/P&gt;&lt;P&gt;Just to be clear: your example code is handling the event on an instance named "bo" and is also setting the edit state on the same instance - I thought that I would need to handle the event on "childBO" and set the edit state on "parentBO" or am I misunderstanding the purpose of the dirtyness?</description><pubDate>Sat, 06 Oct 2007 01:49:23 GMT</pubDate><dc:creator>thegwill</dc:creator></item><item><title>RE: Clarifying expected behaviour when editing related data in a grid</title><link>http://forum.strataframe.net/FindPost11786.aspx</link><description>[quote]Also, for clarification: assuming I can get this working, what would the Undo button do to the child records? Would it undo all changes if I had changed multiple child record values in the grid or just the last row changed? I'm hoping the former...[/quote]&lt;/P&gt;&lt;P&gt;It is the former, by default.&amp;nbsp; However, you will need to change the IncludeInFormUndo property on the form to AllBusinessObjects.&amp;nbsp; By default, it's only PrimaryBusinessObject, which means that a call to Undo() on the form will only undo the changes to the primary business object.&lt;/P&gt;&lt;P&gt;As for the state of the buttons, there is a new event on the business objects, introduced in 1.6.1, called IsDirtyChanged.&amp;nbsp; You'll want to handle that event and set the editing state of the business object.&amp;nbsp;&amp;nbsp;The editing state does not get changed internally unless you manually call the Add() or Edit() methods.&amp;nbsp; So, something like this will change the state of the toolbar buttons:&lt;/P&gt;&lt;P&gt;Private Sub bo_IsDirtyChanged(ByVal sender As Object, ByVal e As EventArgs) Handles bo.IsDirtyChanged&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If bo.IsDirty Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bo.SetEditingState(BusinessEditingState.Editing)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bo.SetEditingState(BusinessEditingState.Idle)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;End Sub</description><pubDate>Tue, 02 Oct 2007 09:19:18 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>