I'm fairly new to c# and business objects and have recently downloaded the demo app and have been having a play.
I have come across a bug in the winform ui that i can't for the life of me work out why.
I'd be grateful if anybody could give me an explanation as to why and some pointers on how to fix this.
Here's the problem: after clicking on the "Apply" button in "Resource Edit" to save a new resource and then choosing the "assign" button, the datagridview does not update itself. If, however, I click in another field on the form e.g. Last name and make a change when i move out of this field the datagridview does indeed update itself. I hope this sufficiently explains the odd behaviour i'm seeing. If you need more info please just ask. In the meantime if anybody has any ideas on this i'd really appreciate some advice.
Many thank!!
Are you running version 2.0 or 2.0.1? There's a known issue with the Apply button code from the book, and 2.0.1 (hopefully) addressed that issue.
http://www.lhotka.net/Articles.aspx?id=6432c872-92ce-4bb8-bc26-b610b71956c8
Hi Rocky,
Thanks for the reply.
I'm running the code as downloaded from the APRESS website. However, i have made the changes to the code as detailed in the errata and it's still not working for me.
OK, i've also just downloaded the latest 2.0.1 version from the website and i'm getting the same problem here too. I guess it works with you? So what am i missing? Basically after making a change and hitting the Apply button i immediately try to assign or unassign and it won't refresh for me.
Thanks,
Huw
Hi kids,
That's a totally different and unrelated problem. Your problem is that the DTC isn't enabled on your computer - or perhaps it is enabled, but you are running WinXP SP2 and haven't followed Microsoft's KB article to defeat all the new security that they put in place to block the DTC from being useful...
RockfordLhotka:
Hi kids,
That's a totally different and unrelated problem. Your problem is that the DTC isn't enabled on your computer - or perhaps it is enabled, but you are running WinXP SP2 and haven't followed Microsoft's KB article to defeat all the new security that they put in place to block the DTC from being useful...
From: kids_pro [mailto:cslanet@lhotka.net]
Sent: Tuesday, June 06, 2006 11:18 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Project Tracker Winform UI bug?RockfordLhotka:
Hi kids,
That's a totally different and unrelated problem. Your problem is that the DTC isn't enabled on your computer - or perhaps it is enabled, but you are running WinXP SP2 and haven't followed Microsoft's KB article to defeat all the new security that they put in place to block the DTC from being useful...
Rocky, will this problem occur if I decided to use MySQL instead of SQL Server.
From: ajj3085 [mailto:cslanet@lhotka.net]Rocky,
Transaction scope won't use DTC unless you open more than one connection within the scope. I have DTC disabled completely on my computer to catch places where I forget to open a more persistant connection in my DAL.
At least, this is the behavior with Sql 2k5. Sql 2k may always use DTC; I'm not sure on that.
Andy
Yes, I see the problem. It is interesting, and I don't know how I didn't run into this when writing Chapter 9 in the first place.
It turns out that after you re-enable the data binding events in the finally block the data isn't refreshed from the underlying data source - at least not automatically. So the controls are bound to the correct data, but that data isn't refreshed. You can solve this by adding the following line in the finally block after turning the event handling back on:
this.ResourceBindingSource.ResetCurrentItem();It appears to be sufficient to trigger a reset on the top level binding source - but that may be due to the nature of the PTWin UI layout, so your mileage may vary... In other words, I imagine it could be the case that you need to reset all binding source objects - though that seems unlikely since you'd have to do a reset on every row for data in a grid (I would think).
OK, to reply to my own reply, there may be a better method: ResetBindings
this.ResourceBindingSource.ResetBindings(false); this.AssignmentsBindingSource.ResetBindings(false);From the description of this method it appears to be the better one to use in general terms, because it triggers a refresh of any bound controls - presumably including grids, etc.
Cool, thank you very much.
Nice to know i was thinking along kinda the same lines. I tried to implement this code prior to raising this topic here but i was putting it in the wrong place!! I originally tried putting it in immediately after rebinding the datasources. Oh well back to the books i guess to read up more about databinding.
Once again thank you very much for your quick response to this problem and for all your help!!!
Copyright (c) Marimer LLC