I received the following error when trying to create a webpart with user controls.
Unable to cast object of type 'ASP._controltemplates_UserControl_ascx' to type 'namespace.class'. I deleted all the files from the location
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files, but still the same error occurs.
Here is the code for referencing the user control.
protected const string defaultUserControlPathField = "~/_controltemplates/myUserControl.ascx";
protected string userControlPathField = defaultUserControlPathField;
namespace.class tempControl;
UserControl myControl;
myControl = (UserControl)this.Page.LoadControl(this.userControlPathField);
tempControl = (namespace.class)myControl;
Does anyone have an idea about this error?
Thanks
V
V