title: ASP.net: dynamically load web user control
body: <p>I have a asp.net web page with place holder control and Menu control when user select an item from the menu. It will dynamically load the control based on menu item's value.</p>
  
  <p>I got the control loaded but if i click on the a link button or anything on the web user control (.ascx) The web user control (.ascx) will disappear. I do not know what is causing this. Can someone take a look at my code and see what i'm missing?</p>
  
  <pre><code>Protected Sub Menu1_Click(ByVal sender As Object, ByVal e As EventArgs)
  
      Select Case Me.Menu1.SelectedValue
          Case "CustMasterMain"
              Dim ccCustMasterMaint As UserControl = CType(Page.LoadControl("~/Controls/Franchise/CustMasterMaintControl.ascx"), UserControl)
              Me.phHolder1.Controls.Add(ccCustMasterMaint)
          Case "AcctRecInq"
              Dim ccAcctRecInq As UserControl = CType(Page.LoadControl("~/Controls/Franchise/custAccountsReceivableInquiry.ascx"), UserControl)
              Me.phHolder1.Controls.Add(ccAcctRecInq)
      End Select
  
  End Sub
  </code></pre>