in asp.net loading a web user control from within another web user control using Page.LoadControl(path)

161 Views Asked by At

I have an asp.net page that have a Web User Control WUC-1 (dynamically added), WUC1 is supposed to load another Web User Control WUC-2.

To accomplish this I am using Page.LoadControl(~/path to control) method. This method suddenly started to error as below

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

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

**

[StackTrace] at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at 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:line 273

[Source] System.Web

[InnerException]

line 273 is exactly from where the above log is generated;

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

I would appreciate if anyone can shed some light on it. It was working perfectly fine from YEARS until now

0

There are 0 best solutions below