title: Creating Panel with images and linkbutton at runtime
body: <p>I have a Masterpage that has Treeview. You can select some nodes there.
  Based on the selection you get some items in the Default.aspx's Placeholder, you get a image and a linkbutton placed in a Panel. Like this :</p>
  
  <p><a href="https://i.stack.imgur.com/A0F69.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A0F69.jpg" alt="alt text"></a>
  </p>
  
  <p>This code is in the Default.aspx that has the Masterpage.</p>
  
  <pre><code>        TreeView nav_tree = ((TreeView)Master.FindControl("treeview_Navigation"));
          string selectedNode = nav_tree.SelectedNode.Value;
  
          var query = from n in dc.Nemanet_Navigations
                      where n.UserId == userGuid &amp;&amp; n.Nav_pID.ToString() == selectedNode &amp;&amp; n.Nav_IsFile == false
                      orderby n.Nav_Name
                      select n;
          foreach (var item in query)
          {
  
              Panel div = new Panel();
              div.ID = item.Nav_ID.ToString();
              div.CssClass = "BulletDiv";
              content_default.Controls.Add(div);
  
              Image picture = new Image();
              picture.ImageUrl = "~/Icons/New_Folder.png";
              div.Controls.Add(picture);
  
              div.Controls.Add(new LiteralControl("&lt;br/&gt;"));
  
              LinkButton description = new LinkButton();
              description.Text = item.Nav_Name;
              description.PostBackUrl = "default.aspx";
              div.Controls.Add(description);
  
          }
  </code></pre>
  
  <p>There seems to be problem when i create the controllers at runtime, when the site does a postback, lets say if i click "Enska" in the treeview i get the results in the image above. Lets say that i then click "The Punk Panther" i get a error.</p>
  
  <blockquote>
    <p>An error has occurred because a
    control with id 'ctl00$CPH_Main$ctl05'
    could not be located or a different
    control is assigned to the same ID
    after postback. If the ID is not
    assigned, explicitly set the ID
    property of controls that raise
    postback events to avoid this error.</p>
  </blockquote>
  
  <p>Also, how would i go by making a event handler for the linkbutton at runtime, can i make one event handler that every linkbutton uses or what ?
  I want the folder and the linkbutton to be clickable and link to the same place, is it simpler to make the whole Panel clickable, if so, how would i get a "OnClick" event on it ?</p>