Hi
We have a web application that loads it's ascx files dynamically. We are investigating storing the content of these ASCX's in a database and loading them via a VirtualPathProv ider.
Our ASCX's are derived from a base class that in turn derives from a UserControl. All good so far, I can get as far as calling LoadControl on the virtual file returned from the path provider. Where things are failing is that when I attempt to cast from UserControl to the base class (VisualElement in this case), the code error's (not able to cast to VisualElement).
When the ascx's are stored in the customary manner (file system as part of the web site), this cast works correctly.
The code that is causing the issue is thus:
In debugging, I've run
This runs and returns an object of type UserControl.
If I run ?x as VisualElement on this in the immediate window, the result is null.
Any idea's ?
We have a web application that loads it's ascx files dynamically. We are investigating storing the content of these ASCX's in a database and loading them via a VirtualPathProv ider.
Our ASCX's are derived from a base class that in turn derives from a UserControl. All good so far, I can get as far as calling LoadControl on the virtual file returned from the path provider. Where things are failing is that when I attempt to cast from UserControl to the base class (VisualElement in this case), the code error's (not able to cast to VisualElement).
When the ascx's are stored in the customary manner (file system as part of the web site), this cast works correctly.
The code that is causing the issue is thus:
Code:
var x = (VisualElement)LoadControl(((InsightVirtualFile)file).VirtualPath);
Code:
var x = LoadControl(((InsightVirtualFile)file).VirtualPath);
If I run ?x as VisualElement on this in the immediate window, the result is null.
Any idea's ?