title: Find Control Inside ListView Control
body: <p>I want to find "Label" control with ID = "Label" inside the "ListView" control. I was trying to do this with the following code:</p>
  
  <pre><code>((Label)this.ChatListView.FindControl("Label")).Text = "active";
  </code></pre>
  
  <p>But I am getting this exception: <b> Object reference not set to an instance of an object </b>. </p>
  
  <p>What is wrong here ?</p>
  
  <p>This is aspx code:</p>
  
  <pre><code>&lt;asp:ListView ID="ChatListView" runat="server" DataSourceID="EntityDataSourceUserPosts"&gt;
      &lt;ItemTemplate&gt;
          &lt;div class="post"&gt;
              &lt;div class="postHeader"&gt;
                  &lt;h2&gt;&lt;asp:Label ID="Label1" runat="server" 
                      Text= '&lt;%# Eval("Title")  + " by " + this.GetUserFromPost((Guid?)Eval("AuthorUserID")) %&gt;' &gt;&lt;/asp:Label&gt;&lt;/h2&gt;
                  &lt;asp:Label ID="Label" runat="server" Text="" Visible="True"&gt;&lt;/asp:Label&gt;
                  &lt;div class="dateTimePost"&gt;
                     &lt;%# Eval("PostDate")%&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="postContent"&gt;
                  &lt;%# Eval("PostComment") %&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ItemTemplate&gt;
  
  &lt;/asp:ListView&gt;
  </code></pre>