Last post Feb 13, 2008 08:21 AM by annalady
Feb 12, 2008 06:51 PM|DotNetChild|LINK
I have created a custom control and as long as the control is in the same directory as the page that it is using it I can create an instance of the control in my code behind and set the properties. Like so:
Feb 12, 2008 08:15 PM|annalady|LINK
When you put a UserControl in a subfolder, the subfolder name becomes part of the class name. Now the class name of your control is probably something like :
You just have to go to the codebehind of your UserControl and change the class name from
Controls_TestControl to TestControl. Also don't forget to change the "Inherits" attribute in your ascx file from Inherits="Controls_TestControl" to
Feb 12, 2008 09:40 PM|DotNetChild|LINK
That is really interesting I had no idea. It worked just fine. However when I go to add my UserControl to my Panel control I get a stack over flow which I have no idea why? I don't even know what a stack over flow is.
Feb 13, 2008 08:21 AM|annalady|LINK
You probably have a loop somewhere in your code. Maybe your code is adding your UserControl to your Panel infinitely.
By the way, please explicitly specify an ID for your UserControl before adding it into the Panel