﻿<?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 » Business Objects and Data Access (How do I?)  » Why Does .Save .CheckRules causes Navigated event to fire</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 17:47:10 GMT</lastBuildDate><ttl>20</ttl><item><title>Why Does .Save .CheckRules causes Navigated event to fire</title><link>http://forum.strataframe.net/FindPost19519.aspx</link><description>Hi,&lt;P&gt;I have a form with parent child objects,&amp;nbsp;both objects have&amp;nbsp;required fields defined. I noticed an issue when a user has broken rules in the child and and parent, and clicks Save button,&amp;nbsp;the children controls lose all the changes as though they get&amp;nbsp;refilled. &lt;/P&gt;&lt;P&gt;After digging around and setting a few breakpoints, I found out that calling .Save or .CheckRules on parent BO causes Navigated even to fire (which executes my code to fill children BOs).&lt;/P&gt;&lt;P&gt;Is this by design? Is there a property I can set to prevent this?&lt;/P&gt;&lt;P&gt;Thank you.</description><pubDate>Fri, 19 Sep 2008 03:42:49 GMT</pubDate><dc:creator>Leonard P.</dc:creator></item><item><title>RE: Why Does .Save .CheckRules causes Navigated event to fire</title><link>http://forum.strataframe.net/FindPost19537.aspx</link><description>Sounds like your biggest problem here is the overhead in filling your child BOs. I would also recommend putting a check in your fill&amp;nbsp;code so that you only do&amp;nbsp;the fill&amp;nbsp;when the parent has changed. Check the parent's primary key against the child's foreign key and if they are the same there is probably no need to run the fill. When you move to a different parent record, the keys will not match and the fill will be triggered.&lt;/P&gt;&lt;P&gt;I would recommend this anyway as it will cut out unnecessary server data operations.</description><pubDate>Fri, 19 Sep 2008 03:42:49 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: Why Does .Save .CheckRules causes Navigated event to fire</title><link>http://forum.strataframe.net/FindPost19523.aspx</link><description>Edhy's suggestion is a good one...but this is by design and correct.&amp;nbsp; You can set a shared property someplace if you want to take certain considerations into affect when checking rules.&amp;nbsp; But when a rule is checked, &lt;STRONG&gt;&lt;EM&gt;&lt;U&gt;all&lt;/U&gt;&lt;/EM&gt;&lt;/STRONG&gt; rows within the BO are evaluated.&amp;nbsp; This will enforce a navigation so any child logic can take place as well since the CheckRulesOnCurrentRow event will be raised and the strong-typed properties evaluated.&lt;/P&gt;&lt;P&gt;If you do not want to move a child record, etc. then you can go at this several ways.&amp;nbsp; First, apply a filter to the BO in question so that only the current record is checked.&amp;nbsp; Second, create a shared property someplace so that the logic in your navigated event doesn't get fired...there are a number of ways to go at this one.</description><pubDate>Thu, 18 Sep 2008 15:34:18 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Why Does .Save .CheckRules causes Navigated event to fire</title><link>http://forum.strataframe.net/FindPost19522.aspx</link><description>Leonard,&lt;P&gt;Take a look at the StrataFlix to see how this is handled by the SF team with more details.&lt;/P&gt;&lt;P&gt;Basically you have to check the rules in the Child Form before returning to the parent form.&amp;nbsp; Here is a sample code I use in all my child forms:&lt;/P&gt;&lt;P&gt;[quote][code]&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; cmdOK_Click(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.Object, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.EventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; cmdOK.Click&lt;/P&gt;&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- This code uses' the form's PrimaryBusiness Object instance to check the validations.&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;If&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;.PrimaryBusinessObject.CheckRules(&lt;FONT color=#0000ff&gt;True&lt;/FONT&gt;) &lt;FONT color=#0000ff&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;DialogResult = Windows.Forms.DialogResult.OK&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Else&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Show a custom InfoBox to alert the end user of the broken rules.&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Dim&lt;/FONT&gt; CountOfBrokenRulesCurrentRow &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Integer&lt;/FONT&gt; =&amp;nbsp;&lt;FONT color=#0000ff&gt;&lt;FONT color=#008000&gt; &lt;/FONT&gt;Me&lt;/FONT&gt;.PrimaryBusinessObject.BrokenRules.Count&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Dim&lt;/FONT&gt; CountOfBrokenRulesAdditionalRows &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Integer&lt;/FONT&gt; = 0&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Dim&lt;/FONT&gt; CountOfBrokenRulesTotal &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Integer&lt;/FONT&gt; = &lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;.PrimaryBusinessObject.BrokenRules.Count&lt;/P&gt;&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;MicroFour.StrataFrame.Messaging.InfoBox.ErrorBox(MicroFour.StrataFrame.UI.Localization.RetrieveTextValue(&lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;.BrokenRulesAlertTitleKey, &lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;.BrokenRulesAlertTitle), &lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;.Format(MicroFour.StrataFrame.UI.Localization.RetrieveTextValue(&lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;.BrokenRulesAlertTextKey, &lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;.BrokenRulesAlertText), CountOfBrokenRulesCurrentRow, CountOfBrokenRulesAdditionalRows, CountOfBrokenRulesTotal), &lt;FONT color=#0000ff&gt;Me&lt;/FONT&gt;)&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;If&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; cmdCancel_Click(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; sender &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; System.Object, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; e &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; System.EventArgs) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Handles&lt;/FONT&gt;&lt;FONT size=2&gt; cmdCancel.Click&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DialogResult = Windows.Forms.DialogResult.Cancel&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;[/code][/quote]&lt;/P&gt;&lt;P&gt;As you can see, the code is petty generic, so I can simply copy/paste in every child form I need.&amp;nbsp; Also, I added code to show the InfoBox effect you see when using the Form's Save().</description><pubDate>Thu, 18 Sep 2008 14:36:33 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>