﻿<?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?)  » ListView Requery After Delete Operation</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 08 Jun 2026 22:43:18 GMT</lastBuildDate><ttl>20</ttl><item><title>ListView Requery After Delete Operation</title><link>http://forum.strataframe.net/FindPost14543.aspx</link><description>I have a ListView that is getting populated on a requery.&amp;nbsp; I am passing in the ListPopulating method (as recommended)&amp;nbsp;one of the business objects on the form along with the BusinessCloneDataType.&amp;nbsp; This is working great.&amp;nbsp; Whereever I need to call the requery method of the ListView, I no longer care about parameters...I just call it.&lt;/P&gt;&lt;P&gt;After a user deletes a record successfully, I thought it would be a good idea to call that requery method.&amp;nbsp; So, after checking success on the delete and the save events, I call the requery method of the ListView.&amp;nbsp; The resulting list is wrong.&amp;nbsp; An entirely different customer is being displayed in the list (the customer comes from a call (PopulatedThroughEvent)&amp;nbsp;in the RowPopulating event).&amp;nbsp; If I navigate away from the main BO and come back, the ListView shows the correct customer.&amp;nbsp; If I add a new record and call the requery method, the ListView show the proper customer.&amp;nbsp; Only the delete is doing this.&amp;nbsp; So, what am I doing wrong?&lt;/P&gt;&lt;P&gt;Thanks!&lt;BR&gt;Bill</description><pubDate>Tue, 26 Feb 2008 12:45:42 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: ListView Requery After Delete Operation</title><link>http://forum.strataframe.net/FindPost14555.aspx</link><description>Looks good, Bill! :)</description><pubDate>Tue, 26 Feb 2008 12:45:42 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: ListView Requery After Delete Operation</title><link>http://forum.strataframe.net/FindPost14553.aspx</link><description>I was calling DeleteCurrentRow() without a parameter.&amp;nbsp; I was forced to add the Save() function to get things going, so I used your tactic, instead.&amp;nbsp; I am now calling DeleteCurrentRow(false).&amp;nbsp; No need to call Save(), anymore.&amp;nbsp; Also, in order to get around another issue that I was having I added another temporary BO into the mix so that the ListView would populate properly.&amp;nbsp; In the RowPopulating event I setup a new BO to reference the BO of the ListView, then I grabbed the foreign key index from the BO and retrieved the field I needed from the customer BO to fill in the name.&lt;/P&gt;&lt;P&gt;It is all quite simple after I worked it all out.&amp;nbsp; Took a little while.&amp;nbsp; The goal was to be able to see a list of items,&amp;nbsp;select one,&amp;nbsp;and provide add/edit/delete capabilities in the same &amp;#119;indow.&amp;nbsp; I attached an example of what I did.&lt;/P&gt;&lt;P&gt;Thanks for your help!&amp;nbsp; Have a great day!!&lt;BR&gt;Bill</description><pubDate>Tue, 26 Feb 2008 11:25:51 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: ListView Requery After Delete Operation</title><link>http://forum.strataframe.net/FindPost14549.aspx</link><description>[quote]&lt;SPAN id=ctl02_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl08_lblFullMessage&gt;Nope...not deleting the parent, just a child.&amp;nbsp; What I did to get around the problem was to explicitly refill the child BO.&amp;nbsp; That seems to have done the trick.&amp;nbsp; &lt;/SPAN&gt;[/quote]&lt;/P&gt;&lt;P&gt;That would work, but it is requireing another trip to the server.&amp;nbsp; I think that you probably called the DeletePrimarykey method instead of the DeleteCurrentRow.&amp;nbsp; The DeletePrimarykey method just "smokes" it from the server and doesn't update the BO.&amp;nbsp; However, the DeleteCurrentRow updates the internal data as well as the server, if you call it with a False, otherwise a Save must happen to commit the deleted record.</description><pubDate>Mon, 25 Feb 2008 21:48:02 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: ListView Requery After Delete Operation</title><link>http://forum.strataframe.net/FindPost14546.aspx</link><description>Nope...not deleting the parent, just a child.&amp;nbsp; What I did to get around the problem was to explicitly refill the child BO.&amp;nbsp; That seems to have done the trick.&amp;nbsp; Thanks for the help!&lt;/P&gt;&lt;P&gt;Bill</description><pubDate>Mon, 25 Feb 2008 17:48:00 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: ListView Requery After Delete Operation</title><link>http://forum.strataframe.net/FindPost14544.aspx</link><description>[quote]If I navigate away from the main BO and come back, the ListView shows the correct customer.&amp;nbsp; If I add a new record and call the requery method, the ListView show the proper customer.&amp;nbsp; Only the delete is doing this.&amp;nbsp; So, what am I doing wrong?[/quote]&lt;P&gt;I assume that you are deleting the parent record.&amp;nbsp; The BOs do not cascade the deletions to the child (by default).&amp;nbsp; You need to clear out the child BO records that are no longer valid by either repopulating the BO, or clearing it out via the Clear method.&amp;nbsp; Or...delete each of the records that are no longer valid.&amp;nbsp; More than likely the cascading deletes have taken place on the server, so you just need to clear out the child BO to match the parent.&amp;nbsp; I recommend doing this manually instead of allowing the deletions or child records to be automatically filtered (other issues that arise from there :) )&lt;/P&gt;&lt;P&gt;[codesnippet]MyBo.Clear()[/codesnippet]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;BR&gt;'-- Delete all of the records that need to be deleted (this code would only delete a single record)&lt;BR&gt;MyBo.DeleteCurrentRow(True)&lt;/P&gt;&lt;P&gt;&lt;BR&gt;'-- Update the BO so that it doesn't reflect any dirty changes.&amp;nbsp; By doing this, you can make a change&lt;BR&gt;'&amp;nbsp;&amp;nbsp; to the BO data and prevent it from trying to persist back to the server.&amp;nbsp; Once called, the BO will no longer be in a&lt;BR&gt;'&amp;nbsp;&amp;nbsp; dirty state.&lt;BR&gt;MyBo.CurrentDataTable.AcceptChanges()[/codesnippet]</description><pubDate>Mon, 25 Feb 2008 16:15:28 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>