0

我有一个带有 Web 用户控件 WUC-1(动态添加)的 asp.net 页面,WUC1 应该加载另一个 Web 用户控件 WUC-2。

为此,我使用 Page.LoadControl(~/path to control) 方法。这个方法突然开始报错如下

[30-08-2020 03:10:46 PM] [ManagementImagesControl.ascx.cs] [mangtListView_ItemCommand] [a87e9f1b-826c-4379-b646-ac85e80f4031] [消息] **

c:\Users\path\Projects\project folder\other folder\WUC-2.ascx(60): error CS0030: Cannot convert type 'string' to 'bool'

**

[StackTrace] 在 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) 在 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) 在 System.Web .Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) 在 System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) 在 System.Web.UI.TemplateControl .LoadControl(String virtualPath) at projectname.Controls.ManagementImagesControl.mangtListView_ItemCommand(Object sender, ListViewCommandEventArgs e) in c:\Users\project folder\other folder\WUC1.ascx.cs:第 273 行

[来源] System.Web

[内部异常]

第 273 行正是上述日志的生成位置;

UserControl ucGal = (UserControl)Page.LoadControl("~/path/WUC-2.ascx");

如果有人能对此有所了解,我将不胜感激。从 YEARS 到现在它工作得非常好

4

0 回答 0