Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ASP.net Web サイト プロジェクトでは、「abc」という App_code フォルダーにクラスがあり、ルート MyControl/Menu.ascx のフォルダーにユーザー コントロールがあります。
私の質問は、「abc」クラス内に UserControl のインスタンスを作成するにはどうすればよいですか? UserControl にアクセスできないためです。
このようにしてみてください
CustomControl cc = (CustomControl)Page.LoadControl("...");
namespace適切なユーザー コントロールを含める
namespace
using YourNamespace;
次に、uer コントロールのインスタンスを作成します
UserControlClass userconrtolinstance = new UserControlClass();