ここでユーザーコントロールを動的にロードするのは別の方法です:
Dim ucSupplierDetails As New UserControl
ucSupplierDetails.LoadControl("~/UserControls/MyUserControl.ascx")
placeholder.Controls.Add(ucSupplierDetails)
編集:ここに 2 番目のオプションがあります。ユーザー コントロールを名前空間に手動で配置します。
Namespace MyUserControlNamespace
Public Class MyUserControl Inherits System.Web.UI.UserControl
End Class
End Namespace
ユーザー コントロールのクラス宣言を変更することを忘れないでください (最後の行の Inherits 属性)。
<%@ Control Language="VB" AutoEventWireup="true"
CodeFile="MyUserControl.ascx.vb"
Inherits="MyUserControlNamespace.MyUserControl" %>
そして今、名前空間によってそれらにアクセスできます:
Dim ucSupplierDetails As New MyUserControlNamespace.MyUserControl