title: ASP.Net AJAX modal popup window
body: <p><strong>First I'll describe the web form layout:</strong></p>
  
  <p>The form contains a GridView1 with a "Details" button that opens a second GridView2, whose purpose of course is to show details of the item selected from parent GridView1.  All controls are rendered dynamically in the server-side codebehind.</p>
  
  <p><strong>The Challenge:</strong></p>
  
  <p>I need to create a modal pop-up window that's presented when the user clicks an icon that's in child GridView2 as an Image control in a TemplateField.  This is so users can add comments to the details in child GridView2.</p>
  
  <p><strong>My approach:</strong></p>
  
  <p>I'm trying to get the AJAXToolKit's modal popup extender (ID = "mpe") wired to the icon in the TemplateField during the PreRender stage. Since the TargetControlID cannot be null or empty, what I'm doing is creating a dummy Button control and setting the modal popup extender's TargetControlID property to the dummy button's ID called, then after the TemplateField is added to GridView2, I set the TargetControlID property to the icon's ID, which is "icon_addComment".</p>
  
  <p><strong>The Problem:</strong></p>
  
  <p>When I try to set the TargetControlID property to the icon's ID, the code throws the error "<strong>The TargetControlID of 'mpe' is not valid. A control with ID 'icon_addComment' could not be found.</strong>".  I'm stumped on how I can get this to work properly, it seems there's no way getting around the condition that the Target Control must be created before the modal popup extender. What I'd like is to just have the child GridView2 icon's ID be the TargetControlID for the modal popup extender</p>