Child UserControl missing datasource when binding through ListView
<p>I have a UserControl that takes a class object as property "DataSource." On DataBind, I apply properties of that object to controls -- TextBox, RadioButton, etc -- inside the UserControl.</p>

<p>This works great when I just set the UC on a page, bind, and go.</p>

<p>Now, I'm attempting to use this control in the <strong>ItemTemplate</strong> of a ListView like so;</p>

<p><code>&lt;ItemTemplate&gt;&lt;uc1:MyItem ID="MyItem1" runat="server" DataSource='&lt;%# Container.DataItem %&gt;' /&gt;&lt;/ItemTemplate&gt;</code></p>

<p>and bind to an array of those objects. The array is populated but I'm reaching my DataBind method of the UC with DataSource = null. Am I missing something?</p>

<p>EDIT: Holidays kept me away from this.</p>

<p>So, apparently I was calling <code>base.DataBind()</code> too late. My <code>LoadForm(DataSource)</code> method to load the object into the form fields preceded <code>base.DataBind()</code>. Swapping them fixed allowed me access to DataSource with no problem.</p>

<pre><code>public override void DataBind()
{
  base.DataBind();
  LoadForm(DataSource);
}
</code></pre>

<p>Am I understanding my problem right? Was I just doing things out of order?</p>
