title: How to create UpdatePanel triggers dynamically
body: <p>I have an UpdatePanel in my default.aspx page and the UpdatePanel has asp placeholder, also I have an ascx control that is the navigation of the site and it is created dynamically based on the data in the database, each navigation item is an ImageButton, and my each loop in DataList has HiddenField value of the URL for each corresponded ascx control like Value="~/controls/somecontrol.ascx"</p>
  
  <p>Here is what I want/need to do:
  I need to create triggers dynamically for my UpdatePanel that is in default.aspx in my ascx navigation control, so what I am exactly looking to do is that my each navigation item that is an "ImageButton" to be a trigger for this UpdatePanel and when you click on it, it will reference the placeholder in UpdatePanel and load the control based on the NavigateUrl path and do placeholder.Controls.Add(mycontrol).</p>
  
  <p><strong>Default.aspx page:</strong></p>
  
  <pre><code> &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
      &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
          &lt;ContentTemplate&gt;
              &lt;asp:PlaceHolder ID="phMainHolder" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
          &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p><strong>Navigation ascx control:</strong></p>
  
  <pre><code>&lt;asp:DataList ID="dlnavigations" runat="server"  RepeatDirection="Horizontal" 
                  onitemcommand="dlnavigations_ItemCommand" OnItemDataBound="dlnavigations_ItemDataBound"&gt;
                  &lt;ItemTemplate&gt;                      
                      &lt;asp:HiddenField ID="hfURL" Value='&lt;%#Eval("strUrl")%&gt;' runat="server" /&gt;     
  
                          &lt;asp:ImageButton ID="imgTab" Width="20"   CommandArgument='&lt;%#Eval("ID")%&gt;'  
                              ImageUrl='&lt;%#Eval("strIcon")%&gt;' runat="server" /&gt;                        
                  &lt;/ItemTemplate&gt;
              &lt;/asp:DataList&gt;
  
  
  protected void dlnavigations_ItemCommand(object source, DataListCommandEventArgs e)
              {
                  HiddenField hfURL = (HiddenField)e.Item.FindControl("hfURL");
                  Control ctrl = LoadControl(hfURL.Value);
                  myplaceholderinUpdatePanel.Controls.Clear();
                  //here i need to reference my placeholder in UpdatePanel then
                  myplaceholderinUpdatePanel.Controls.Add(ctrl);
  
              }
  </code></pre>
  
  <p>I am not very sure if this is really possible to do with UpdatePanel please any help appropriated, if i cant do it with UpdatePanel are there any other way of doing this same concept? </p>
  
  <p>thank.</p>