title: ASP.Net List View EmptyItemTemplate not displaying
body: <p>I'm binding a ListView to a collection of objects which is working fine. Unfortunately when the collection is empty then I'm not getting the text in the EmptyItemTemplate element displayed as I would expect.</p>
  
  <p>Markup code is</p>
  
  <pre><code>        &lt;asp:ListView ID="lvBuildingContactsGrid" runat="server" 
              onitemcommand="lvBuildingContactsGrid_ItemCommand" &gt;
              &lt;LayoutTemplate&gt;
                     &lt;!-- some more html markup --&gt;
               &lt;asp:PlaceHolder ID="itemPlaceholder" runat="server" /&gt;
                     &lt;!-- some more html markup --&gt;
              &lt;/LayoutTemplate&gt;
              &lt;ItemTemplate&gt;
                     &lt;!-- some item makup --&gt;           
              &lt;/ItemTemplate&gt;
              &lt;EmptyItemTemplate&gt;
                     &lt;p&gt; empty text that isn't displaying &lt;/p&gt;                
              &lt;/EmptyItemTemplate&gt;
          &lt;/asp:ListView&gt;
  </code></pre>
  
  <p>The code behind to bind is</p>
  
  <pre><code>        ContactRoleCollection contactRoles = new ContactRoleCollection();
          contactRoles.ContactRoleSearchByBuildingID(int params);
  
          lvListView.DataSource = contactRoles;
          lvListView.DataBind();
  </code></pre>
  
  <p>When the collection returns a count of zero then the EmptyItemTemplate text doesn't display. I have viewed the page source and it isn't rendered at all (rather than being hidden). I have replaced the DataSource object just with null i.e.</p>
  
  <pre><code>lvListView.DataSource = null
  </code></pre>
  
  <p>Just to test it and it still doesn't work. No text rendered again.</p>
  
  <p>I have had this problem on other pages I have worked on (and given up and done kludge work arounds) so it's obviously just something that I am missing - doing incorrectly.</p>
  
  <p>Any input appreciated</p>