InfoPath stops loading drop-down values from data connection

A very strange problem indeed …
 
We have an InfoPath (SP1) form the has a handful of drop-down lists each of which gets its values from a secondary data source.  This data source, in turn, gets its data from a web service.  Very straightforward and very "working."  That is, until it randomly stopped working.
 
We could not figure out why it stopped as we hadn’t made any major changes.  Although, we did frequently update the data connection between dev and deployment servers so we thought the constant back-and-forth somehow screwed up the various XSDs and XSLs that are in the InfoPath solution.  Given our assumption, we deleted the data connection and replaced it (no dice) then deleted the drop-downs and the data connections and still no luck.  As a last ditch effort we reverted back to an older version of most of the files, deleted all binaries, cleared all cahces.  Same behavior! What the ….
 
After many many many hours of trying different combinations of everything we could think of … I decided that we needed to re-create the view.  However, there are well over one hundred fields on this form so doing this from scratch was simply not an option.  So, on a whim, I created a new view, cut/pasted the default view’s content to the new view, deleted the old view and made sure the new view was set as the default view.
 
Now everything works fine. Go figure!

Events not firing for controls in the HeaderTemplate of a Repeater

Problem
At a client’s site, we were making extensive use of Repeater controls to render data piped to it via a custom entity and collection.  In addition, we wanted to implement sorting in the repeater using LinkButtons which were rendered in the HeaderTemplate of the Repeater.  So for so good … seems like a pretty reasonable request and it works. 
 
In addition to this, we also hosted these Repeaters (amongst other UI elements) in a UserControl so that we could take advantage of the WYSIWYG design features of Visual Studio.Net.  These UserControls, in turn, were to be re-used in several aspects: hosted on ASP.Net web pages, loaded dynamically into server controls, and loaded dynamically into SharePoint WebParts.  The last was the most important as prior to ASP.Net 2.0 there are no easy WYSIWYG methods for creating WebParts so we decided to host UserControls inside WebParts.
 
At this point, the UserControls worked just fine when hosted on an ASP.Net web page leading us believe everything was ok.  We dropped the user controls onto the test web page and used the Page_Load event to pass data into the control to be rendered.  The LinkButtons that were in the header of the Repeaters re-sorted the data and everything looked great.
 
Next came the WebParts
At this point we created WebParts that were designed to host the UserControls and pass along any personalization and configuration properties from SharePoint’s Storage to the UserControl.  Again, everything appeared to be working great with one exception: The LinkButtons were no longer sorting!  I figured it had something to do with the fact that I was lazy and did all of my work in the RenderWebPart method (no need to lecture me; I have learned my lesson).  I moved the call to Page.LoadControl to the CreateChildControls() method where it should have been the entire time.  This would assure that the UserControls were created and added to the Page’s collection in time for the events to fire.  Almost there….
 
Still … the events did not fire but I still had a little bit of laziness left in me.  My thoughts went back to when I gave SharePoint WebPart development training.  In my own words were: "You should create the controls in CreateChildControls, load them in the Load event of that control, and ONLY render them in RenderWebParts."  Of course, there is a reason for this which I now realize. 
 
In a Repeater control, the HeaderTemplate (and FooterTemplate) is not created until the DataBind event is called and, thus, any controls in the template will not exist until that happens.  In my laziness I had not moved the actual loading of the data in the UserControl out of the RenderWebPart method so while the control itself was getting added to the controls collection at the correct time, the LinkButtons did not exist.  Following my own advice I moved the loading code into the UserControl’s Load event (on the web part) and now everything works as advertised.
 
The Moral
Having passed my ASP.Net MCP … I should have known better.  Having uttered the words in training that would have prevented this from being a problem in the first place … I should have known better.  Being lazy at the wrong time … priceless.