title: Find a Control in Asp.net Listview Inside the Selected Item Template
body: <p>I'm converting functionality from an asp.net Gridview to a Listview.  In the gridview when the selected item changed I would grab a value from a label in the selected row and write it to a different label outside of the gridview.</p>
  
  <pre><code>Protected Sub grdModules_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdModules.SelectedIndexChanged
  
      Dim lblModuleTitle As Label = grdModules.SelectedRow.FindControl("lblModuleTitle")
      lblCurrentModule.Text = lblModuleTitle.Text
  
  End Sub
  </code></pre>
  
  <p>In a Listview, there isn't a "SelectedRow" concept but a SelectedItem.  However you can't do findcontrol against the selected item.  When I try to do the following (I get a null reference exception):</p>
  
  <pre><code>Protected Sub listviewModules_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles listviewModules.SelectedIndexChanged
  
      Dim lblModuleTitle As Label = CType(listviewModules.FindControl("lblModuleTitle"), Label)
      lblCurrentModule.Text = lblModuleTitle.Text
  
  End Sub
  </code></pre>
  
  <p>Does anyone know the way to find a control inside the selected item template?</p>