title: How I can use the Controls from jquery PopUpDialog in my ASP.NEt Application
body: <p>My Application:</p>
  
  <p>I have a ASP.NET Application with two parts. First part is the "Absence" Part and the second part is "Signature". This Application create this parts Automatic. For Absence the User must input the Enddate from this absence and a representative. The TextBox for the representative have a AutoComplete that get Data from the Active Directory. And with a Image on the right side of the textbox, the user can search a representative in a Modal popup from jQuery. The Popup has one textbox and a imagebutton with a magnifying glass Symbol. Now I want that if I click on this Symbol I get all found representative in a ListView in the PopUpBox with a fixed Width and Height. </p>
  
  <p>My Problem:</p>
  
  <p>My PopUp open and I can set my Controls in the div block for this popupdialog. I have create a Event for my ImageButton and generate the Code for this but if I click on the Button (in the popupdialog) the Code don't work. It doesn't jump in the Button_click Method :( </p>
  
  <p>My Question:</p>
  
  <p>How I can use the Controls in my popupdialog with jquery and asp.net? </p>
  
  <p>Here my Code:</p>
  
  <p>ASPX: (jquery code)</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
  
          $(document).ready(function () {
              $("#dialogbox").dialog({
                  autoOpen: false,
                  modal: true,
                  resizable: false,
                  buttons: {
                      "OK": function () {
                          $(this).dialog("close");
                      },
                      "Cancel": function () {
                          $(this).dialog("close");
                      }
                  }
              });
  
              $("#imgVertreter").click(function () {
                  $("#dialogbox").dialog("open");
                  return false;
              });
          }); 
  
      &lt;/script&gt;
  </code></pre>
  
  <p>aspx: (my popupdialogbox div code)</p>
  
  <pre><code>&lt;div id="dialogbox" title="Gesammte Vertreterliste"&gt;
          &lt;asp:TextBox ID="pVertreter" runat="server"&gt;&lt;/asp:TextBox&gt;
          &lt;asp:ImageButton ID="pImageSearch" runat="server" 
          ImageUrl="~/App_Theme/lupe.jpg" Height="23px" Width="24px" 
              onclick="pImageSearch_Click" /&gt;&lt;br /&gt;
          &lt;hr /&gt;
          &lt;asp:ListView runat="server" ID="ListView"&gt;
  
              &lt;LayoutTemplate&gt;
                  &lt;table id="UserTable" runat="server" border="0" width="100%" cellpadding="0" cellspacing="0"&gt;
                      &lt;tr style="background-color:#ccdaeb" class="tableClass"&gt;
                          &lt;th align="left" id="th4" runat="server"&gt;&lt;asp:Label ID="lblName" runat="server" Text="Name, Vorname"&gt;&lt;/asp:Label&gt;&lt;/th&gt;
                          &lt;th align="left" id="th3" runat="server"&gt;&lt;asp:Label ID="lblAbteilung" runat="server" Text="Abteilung"&gt;&lt;/asp:Label&gt;&lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
              &lt;/LayoutTemplate&gt;
  
              &lt;ItemTemplate&gt;
                  &lt;tr&gt;
                    &lt;td align="left"&gt;&lt;asp:LinkButton CssClass="MyLink" CommandName="Select" CommandArgument='&lt;%# Container.DataItemIndex %&gt;' ID="lblFullname" Text='&lt;%# Eval("Name") %&gt;' runat="server"&gt;&lt;/asp:LinkButton&gt;&lt;/td&gt;
                    &lt;td align="left"&gt;&lt;asp:LinkButton CssClass="MyLink" CommandName="Select" CommandArgument='&lt;%# Container.DataItemIndex %&gt;' ID="lblAbteil" Text='&lt;%# Eval("Abteilung") %&gt;' runat="server"&gt;&lt;/asp:LinkButton&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/ItemTemplate&gt;
  
              &lt;EmptyDataTemplate&gt;
                  Es wurden keine Einträge gefunden
              &lt;/EmptyDataTemplate&gt;
  
              &lt;AlternatingItemTemplate&gt;
                  &lt;tr class="TableClass"&gt;
                      &lt;td align="left"&gt;&lt;asp:LinkButton CssClass="MyLink" CommandName="Select" CommandArgument='&lt;%# Container.DataItemIndex %&gt;' ID="lblFullname" Text='&lt;%# Eval("Name") %&gt;' runat="server"&gt;&lt;/asp:LinkButton&gt;&lt;/td&gt;
                    &lt;td align="left"&gt;&lt;asp:LinkButton CssClass="MyLink" CommandName="Select" CommandArgument='&lt;%# Container.DataItemIndex %&gt;' ID="lblAbteil" Text='&lt;%# Eval("Abteilung") %&gt;' runat="server"&gt;&lt;/asp:LinkButton&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/AlternatingItemTemplate&gt;
  
          &lt;/asp:ListView&gt;
  
      &lt;/div&gt;
  </code></pre>
  
  <p>My C# Code for the imageButton (pImageSearch)</p>
  
  <pre><code> protected void pImageSearch_Click(object sender, ImageClickEventArgs e)
          {
              try
              {
                  UserService srv = new UserService();
  
                  DataTable dt = srv.BenutzerFinden(Domain, pVertreter.Text);
                  DataView dv = new DataView(dt);
  
                  dv.Sort = "Nachname ASC";
  
                  this.ListView.DataSource = dv;
                  this.ListView.DataBind(); 
              }
              catch (Exception)
              {
  
              }
  
  
          }
  </code></pre>
  
  <p>Here is a Picture from my Application :</p>
  
  <p><img src="https://i.stack.imgur.com/iQt0j.jpg" alt="enter image description here"></p>
  
  <p>Sourcecode in IE for my TestApplication that works!</p>
  
  <pre><code>&lt;div id="dialog" title="Liste"&gt;
  &lt;input name="txtBox" type="text" value="rettet" id="txtBox" /&gt;
  &lt;input type="submit" name="btnEdit" value="übergeben" id="btnEdit" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Sourcecode for my main Application that don't work!</p>
  
  <pre><code>&lt;div id="dialogbox" title="Vertreterliste"&gt;
  &lt;input name="pVertreter" type="text" id="pVertreter" /&gt;
  &lt;input type="image" name="pImageSearch" id="pImageSearch" src="App_Theme/lupe.jpg" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&amp;quot;pImageSearch&amp;quot;, &amp;quot;&amp;quot;, true, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, false, false))" style="height:23px;width:24px;" /&gt;&lt;br /&gt;
  &lt;input type="submit" name="suchen" value="suchen" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&amp;quot;suchen&amp;quot;, &amp;quot;&amp;quot;, true, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, false, false))" id="suchen" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Why is here a onclick with a dopostback Oo? </p>