M
MurdockSE
Greetings. I am upgrading an older site which used ASP .NET 1.1 and VB
as the code-behind. I've given up on trying to automatically update it,
and I started re-building it a page at a time to ASP .NET 2.0
standards. Everything has been successful (thank god), but I have one
bug left that is vexing me. The programmer is attempting to create an
object of a user control for use in a public class. For example, the
'public' class itself is known as Policy, and is in the pre-verbial
App_Code directory. Inside that class it is attempting to create
objects from user controls which cannot be in the App_Code folder. The
user controls are inside a folder known as "uc", and they are partial
classes, inheriting the user control class.
For example, this is the headers of a user control code-behind know as
"address.ascx.vb". It is in a folder call "uc" in the main website
root.
Partial Class uc_address
Inherits System.Web.UI.UserControl
That is it's declaration. It works perfectly fine in other web forms,
etcetera, as a normal user control would be expected to.
Now, the problem:
They also have the public class "Policy", as stated before, placed into
the App_Code folder :
Public Class Policy
Inherits System.Web.UI.Page
'user controls
Protected ucAddress As uc_address
Now, as you can see above, the programmer attempts to create an object
of a user control within the App_Code folder. Again, having rebuilt it
from ASP .NET 1.1 to 2.0 is the likely the fundamental issue here.
The questions:
1.) How do I properly declare an object based upon a partial class user
control in a public class in ASP .NET 2.0?
2.) Is there another way entirely to do this?
The interesting part:
I can COPY and PASTE the address.ascx.vb file into the App_Code folder,
and the object can be declared in the public class! But the catch is
that it refers to items within the address.ascx control page! ** , and
if I import both of the files into App_Code, it errors out saying that
App_Code cannot contain that type of file.
Thanks for any help you might be able to provide with this problem,
Peter Robbins
as the code-behind. I've given up on trying to automatically update it,
and I started re-building it a page at a time to ASP .NET 2.0
standards. Everything has been successful (thank god), but I have one
bug left that is vexing me. The programmer is attempting to create an
object of a user control for use in a public class. For example, the
'public' class itself is known as Policy, and is in the pre-verbial
App_Code directory. Inside that class it is attempting to create
objects from user controls which cannot be in the App_Code folder. The
user controls are inside a folder known as "uc", and they are partial
classes, inheriting the user control class.
For example, this is the headers of a user control code-behind know as
"address.ascx.vb". It is in a folder call "uc" in the main website
root.
Partial Class uc_address
Inherits System.Web.UI.UserControl
That is it's declaration. It works perfectly fine in other web forms,
etcetera, as a normal user control would be expected to.
Now, the problem:
They also have the public class "Policy", as stated before, placed into
the App_Code folder :
Public Class Policy
Inherits System.Web.UI.Page
'user controls
Protected ucAddress As uc_address
Now, as you can see above, the programmer attempts to create an object
of a user control within the App_Code folder. Again, having rebuilt it
from ASP .NET 1.1 to 2.0 is the likely the fundamental issue here.
The questions:
1.) How do I properly declare an object based upon a partial class user
control in a public class in ASP .NET 2.0?
2.) Is there another way entirely to do this?
The interesting part:
I can COPY and PASTE the address.ascx.vb file into the App_Code folder,
and the object can be declared in the public class! But the catch is
that it refers to items within the address.ascx control page! ** , and
if I import both of the files into App_Code, it errors out saying that
App_Code cannot contain that type of file.
Thanks for any help you might be able to provide with this problem,
Peter Robbins