In a ASP.net Website project, I have a class in App_code folder called "abc" and have user control in a folder on root MyControl/Menu.ascx.
Now my question is how can I create an instance of my UserControl inside my "abc" class? because UserControl is not accessible.
像这样尝试
CustomControl cc = (CustomControl)Page.LoadControl("...");
Include proper namespace
of your user control
using YourNamespace;
Then Create Instance of uer control
UserControlClass userconrtolinstance = new UserControlClass();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.