title: Using jQuery UI's modal dialog inside ASP.NET
body: <p>Currently I have a project where I have a form in ASP.NET that needs a look up service. For example the input below wants a Customer ID, but maybe the user only knows the customers by name.</p>
  
  <pre><code>&lt;input name="CustomerId" type="text" id="CustomerId" /&gt;
  </code></pre>
  
  <p>I'd like to use jQuery UI's modal dialog to append an image to the right of this input, which fires <code>dialog("open")</code> containing the necessary code to look up a customer by name, returning the ID back to the form input upon closing the dialog. This is extremely similar functionality to the Datepicker's icon trigger found here: <a href="http://jqueryui.com/demos/datepicker/#icon-trigger" rel="nofollow noreferrer">http://jqueryui.com/demos/datepicker/#icon-trigger</a></p>
  
  <p>Right now, I have this javascript:</p>
  
  <pre><code>$("#CustomerId").dialog({
      autoOpen: false,
      modal: true,
      draggable: false,
      resizable: false,
      buttons: {
          Ok: function () {
              $(this).dialog("close");
          },
          Cancel: function () {
              $(this).dialog("close");
          }
      }
  });
  
  $("#CustomerId").click(function () {
      $("#CustomerIdDialog").dialog("open");
      return false;
  });
  </code></pre>
  
  <p>I need to be able to pass the ID of the input element into jQuery, probably using the $(this) selector somehow. I'd like to be able to re-use the same code for multiple elements on the same form that require the customer ID look up. I also don't know how to create this kind of functionality inside the ASP.NET environment because it doesn't fundamentally allow more than one form inside one .aspx page.</p>
  
  <p>Any help or guidance in the right direction is greatly appreciated!</p>