it may also depend upon what type of project you are doing. (you mentioned that you have an app_code folder, and i think that app_code folders are only used in web sites, not web apps.)
with a web app, you control source files look something like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace XUCS.code.controls
{
public partial class CourseDisplay : System.Web.UI.UserControl
{
the namespace line is automatically generated to be ProjectNamespace.ParentFolder.ChildFolder
for web site projects, the namespace block is removed, but now the class name (that is, if kept as default) reflects the controls folder path. so all there would be to define the control would be
public partial class Code_Controls_CourseDisplay : System.Web.UI.UserControl
So, if you are using a web site project, then you should already be doing it right, as long as you are sure you are using the full class name on the controls code file.
Instead of referring to your code via a general example, could you possibly post (or email me) the actual code you are using?
jzimmerman20...
Member
503 Points
183 Posts
Re: Using the class of a user control in code-behind
May 22, 2009 02:05 PM|LINK
it may also depend upon what type of project you are doing. (you mentioned that you have an app_code folder, and i think that app_code folders are only used in web sites, not web apps.)
with a web app, you control source files look something like this:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace XUCS.code.controls { public partial class CourseDisplay : System.Web.UI.UserControl {the namespace line is automatically generated to be ProjectNamespace.ParentFolder.ChildFolder
for web site projects, the namespace block is removed, but now the class name (that is, if kept as default) reflects the controls folder path. so all there would be to define the control would be
public partial class Code_Controls_CourseDisplay : System.Web.UI.UserControl
So, if you are using a web site project, then you should already be doing it right, as long as you are sure you are using the full class name on the controls code file.
Instead of referring to your code via a general example, could you possibly post (or email me) the actual code you are using?