<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Update Bound Control in code</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Update Bound Control in code</description>
  <pubDate>Thu, 11 Jun 2026 03:12:24 -700</pubDate>
  <lastBuildDate>Tue, 17 Jun 2008 08:20:42 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=837</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Update Bound Control in code : I&amp;#039;m glad that helped. It...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3087#3087</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 837<br /><strong>Posted:</strong> 17-Jun-2008 at 8:20am<br /><br /><P>I'm glad that helped.</P><DIV>It is not so much an issue of getting the current object so much as it is using an overload&nbsp;of SaveChanges that takes an EntityList.</DIV>]]>
   </description>
   <pubDate>Tue, 17 Jun 2008 08:20:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3087#3087</guid>
  </item> 
  <item>
   <title>Update Bound Control in code : Okay, that was simple. I was looking...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3086#3086</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=300" rel="nofollow">pucsoftware</a><br /><strong>Subject:</strong> 837<br /><strong>Posted:</strong> 17-Jun-2008 at 8:11am<br /><br />Okay, that was simple. I was looking for a Save method on the entity object. I guess when you use the PersistanceManager to get the current object you get a reference to the object and the PersistanceManager manages the updates. cool. I didn't think it would do this but it works! Thanks.]]>
   </description>
   <pubDate>Tue, 17 Jun 2008 08:11:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3086#3086</guid>
  </item> 
  <item>
   <title>Update Bound Control in code : Darren,  Yes. That will give...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3082#3082</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 837<br /><strong>Posted:</strong> 16-Jun-2008 at 3:03pm<br /><br />Darren,<DIV>&nbsp;</DIV><DIV>Yes.&nbsp; That will give you the current Employee.&nbsp; Then, if you want to change the First Name to "Nancy", just write:</DIV><DIV>&nbsp;</DIV><DIV>mEmployee.FirstName = "Nancy"</DIV><DIV>&nbsp;</DIV><DIV>Now, to save all the changes in the application, use something like this: </DIV><DIV>&nbsp;</DIV><DIV><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT face="Times New Roman"><SPAN style="COLOR: blue; mso-no-proof: yes">private</SPAN><SPAN style="mso-no-proof: yes"> <SPAN style="COLOR: blue">void</SPAN> SaveAllChanges() {<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></FONT></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (mPersMgr.HasChanges()) {<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">try</SPAN> {<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>mPersMgr.SaveChanges();<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>MessageBox.Show(<SPAN style="COLOR: #a31515">"Changes saved to database"</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>} <SPAN style="COLOR: blue">catch</SPAN> (PersistenceManagerSaveException ex) {<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>MessageBox.Show(<SPAN style="COLOR: #a31515">"Errors saving changes to database: \n\n"<o:p></o:p></SPAN></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>+ ex.SaveResult.Exception.ToString());<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>} <SPAN style="COLOR: blue">else</SPAN> { MessageBox.Show(<SPAN style="COLOR: #a31515">"No changes to save"</SPAN>); }<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}</P><DIV></DIV><DIV></DIV><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt">If you want just to save the one employee, put the single employee in an EntityList and do a SaveChanges on the EntityList.</P><DIV></DIV></FONT></FONT></SPAN></DIV>]]>
   </description>
   <pubDate>Mon, 16 Jun 2008 15:03:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3082#3082</guid>
  </item> 
  <item>
   <title>Update Bound Control in code : I understand that I can&amp;#039;t...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3080#3080</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=300" rel="nofollow">pucsoftware</a><br /><strong>Subject:</strong> 837<br /><strong>Posted:</strong> 16-Jun-2008 at 8:57am<br /><br />I understand that I can't change the value by referencing the text box. To be more specific, can you supply me with a small code example on what to reference. I can get a reference to the current record by using:<DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>mEmployee = (</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>Employee</FONT></FONT><FONT size=2>) bsEmployee.Current;</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>This works okay to read additional data from the fields, but I can't use this method to save any changes. I suspect that you would go through the PersistanceManager object but I don't see how. An example would be helpful.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Darren</DIV></FONT>]]>
   </description>
   <pubDate>Mon, 16 Jun 2008 08:57:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3080#3080</guid>
  </item> 
  <item>
   <title>Update Bound Control in code : Darren,  After reading through...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3073#3073</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 837<br /><strong>Posted:</strong> 12-Jun-2008 at 10:23pm<br /><br />Darren,<DIV>&nbsp;</DIV><DIV>After reading through my response, I realized I didn't really answer youur question.&nbsp; In the fist case, there is a series of events that get triggered that eventually causes a setter to get fired , and the setter causes a change in the persistence manager cache.&nbsp; In the second case, this sequence of events does not occur, and the setter does not get fired.</DIV><DIV>&nbsp;</DIV><DIV>If you want your code changes to cause a change in the database, modify the entity, not the text box.</DIV><DIV>&nbsp;</DIV><DIV>David</DIV>]]>
   </description>
   <pubDate>Thu, 12 Jun 2008 22:23:06 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3073#3073</guid>
  </item> 
  <item>
   <title>Update Bound Control in code : Darren,  In the first case,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3072#3072</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 837<br /><strong>Posted:</strong> 12-Jun-2008 at 9:50pm<br /><br />Darren,<DIV>&nbsp;</DIV><DIV>In the first case, databinding occurs.&nbsp; The value in the textbox is consistent with the value of the entity in the Persistence Manager cache.&nbsp; There is a bidirectional relationship.</DIV><DIV>&nbsp;</DIV><DIV>In the second case, there is no databinding.&nbsp; Changing the value of the TextBox has no effect on the entity in the Persistence Manager Cache.</DIV><DIV>&nbsp;</DIV><DIV>IN the first case, a setter is fired.</DIV><DIV>&nbsp;</DIV><DIV>In the second case, there is no setter which fires.</DIV><DIV>&nbsp;</DIV><DIV>David</DIV>]]>
   </description>
   <pubDate>Thu, 12 Jun 2008 21:50:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3072#3072</guid>
  </item> 
  <item>
   <title>Update Bound Control in code : I want to update a bound field...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3062#3062</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=300" rel="nofollow">pucsoftware</a><br /><strong>Subject:</strong> 837<br /><strong>Posted:</strong> 11-Jun-2008 at 8:48am<br /><br />I want to update a bound field on my control using code. Otherwise, I am using the LookupDataGrid from DevExpress so that I can build a sophistcated lookup box with filtering, change color of rows based on data, show images, etc. So, this LookupDataGrid is not bound by the PersistenceManager it is simply a lookup list. When the user selects a value from the list I use an event to capture the key to what they selected. This key value is stored in a seperate field that is bound to the PersistenceManager using a text box. If I manually change the value in the text box the data is changed and updated on a save changes command. However, if I select a value from the LookupDataGrid and populate the textbox with the change in code, the PersistenceManager does not save the changes. <DIV></DIV><DIV></DIV>Here is my event handler<DIV><FONT color=#808080 size=2><FONT color=#808080 size=2></FONT></FONT>&nbsp;</DIV><DIV><FONT color=#808080 size=2><FONT color=#808080 size=2>/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */</DIV></FONT></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> gridLuDepartment_EditValueChanged(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EventArgs</FONT></FONT><FONT size=2> e) {</P><P>txtDepartmentKey.Text = gridLuDepartment.EditValue.ToString();</P></FONT><FONT size=2><P></P><P>}</P><DIV></DIV><DIV>Again, visually the value in the textbox is changed but the underlying value in the PersistenceManager is not. How would I do something like this?</DIV><DIV>&nbsp;</DIV><DIV>Darren</FONT></DIV>]]>
   </description>
   <pubDate>Wed, 11 Jun 2008 08:48:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=837&amp;PID=3062#3062</guid>
  </item> 
 </channel>
</rss>