title: Access dropdownlist value which is kept outside listview?
body: <p>I have a listview and a dropdownlist ( this is kept outside listview) and one search button.</p>
  
  <p>Now i need to access two literal control from listview which are kept in layout template and emptydatatemplate and assign the dropdownlist value to those literal control with few extra text.</p>
  
  <p>what i tried was for layout template:</p>
  
  <pre><code>protected void lvP_LayoutCreated(object sender, EventArgs e)
      {
          if (dlCategory.SelectedIndex != -1)
          {
              (lvP.FindControl("ltHeaderText") as Literal).Text = " Products in " + dlCategory.SelectedItem.Text.ToString();
          }
      }
  </code></pre>
  
  <p>and for empty data i tried below</p>
  
  <pre><code>protected void lvPr_ItemCreated(object sender, ListViewItemEventArgs e)
      {
          if (e.Item.ItemType == ListViewItemType.EmptyItem)
          {
              (lvP.FindControl("ltEmptyData") as Literal).Text = "No products in " + dlCategory.SelectedItem.Text.ToString();
          }
      }
  </code></pre>
  
  <p>aspx markup</p>
  
  <pre><code>&lt;asp:ListView ID="lvP" runat="server" OnLayoutCreated="lvP_LayoutCreated"
              OnItemCreated="lvP_ItemCreated"&gt;
              &lt;LayoutTemplate&gt;
                  &lt;table class="PWorld" cellpadding="0" cellspacing="0"&gt;
                      &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th&gt;
                                  &lt;span&gt;
                                      &lt;asp:Literal ID="ltHeaderText" runat="server"&gt;&lt;/asp:Literal&gt;
                                  &lt;/span&gt;
                              &lt;/th&gt;
                          &lt;/tr&gt;
                      &lt;/thead&gt;
                      &lt;tbody&gt;
                          &lt;tr id="itemplaceHolder" runat="server"&gt;
                          &lt;/tr&gt;
                      &lt;/tbody&gt;
                  &lt;/table&gt;
              &lt;/LayoutTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;tr valign="top"&gt;
                      &lt;td&gt;
                          &lt;table class="PWorldInner" cellpadding="0" cellspacing="0"&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;
                                      &lt;img height="65px" width="175px" src='&lt;%#Eval("ProductLogo")%&gt;' alt="&lt;%#Eval("pName")%&gt;" /&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/table&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/ItemTemplate&gt;
              &lt;EmptyDataTemplate&gt;
                  &lt;asp:Literal ID="ltEmptyData" runat="server"&gt;&lt;/asp:Literal&gt;
              &lt;/EmptyDataTemplate&gt;
          &lt;/asp:ListView&gt;
  </code></pre>