How to dynamically add items to list box inside Modal Popup  in asp.net c#
<p>I have a <code>Listbox</code> which I add items to it in the <code>OnClick</code> event. I have this <code>Listbox</code> inside a panel(<code>Pnl_Pdfviewers</code>) and <code>table</code>.</p>

<p>This panel is the pop up panel which is make it visible in the <code>onclick</code> event</p>

<pre><code>  Onclickevent
   {
       //Call method to fill list box
       ModalPopupExtender2.Show();
   }


    // Fill list box
    reader = server.ExecuteReader(CommandType.Text, usernameQuery, paramete);
    while (reader.Read())
    {
        lst_PdfViewers.Items.Add(reader["Name"].ToString());
    }
    reader.Close();
</code></pre>

<p>everything is fine, but the <code>listbox</code> is always empty. I read the value from the <code>table</code> and add that to the <code>listbox</code>. Why is the <code>listbox</code> empty always?</p>

<pre><code>&lt;asp:ModalPopupExtender ID="ModalPopupExtender2" BackgroundCssClass="modalBackground"                 TargetControlID="btnShowPopup2"  CancelControlID="btn_PdfCancel"  PopupControlID="Pnl_Pdfviewers" runat="server"&gt; &lt;/asp:ModalPopupExtender&gt;
  &lt;asp:Panel ID="Pnl_Pdfviewers" runat="server" BackColor="White" Height="250px" Width="350px" Style="display: none"&gt;
     &lt;table&gt;
        &lt;tr&gt;
          &lt;td align="center"&gt;
             &lt;asp:ListBox ID="lst_PdfViewers"   runat="server" &gt;&lt;/asp:ListBox&gt;
           &lt;/td&gt;
         &lt;/tr&gt;
     &lt;/table&gt; 
  &lt;/asp:Panel&gt;
</code></pre>

<p>UPDATE:</p>

<pre><code> DataSet ds = new DataSet();
            ds = server.ExecuteQuery(CommandType.Text, usernameQuery, paramete);
           lst_PdfViewers.DataSource = ds;
           lst_PdfViewers.DataBind();
</code></pre>

<p>Databinding is done successfully but it is not displaying inside the modal pop up extender</p>
