reference to Composite Control

S

Sparticus

Hi,

I have created a composite control which, in its simplest form inherits from
Control, implements INamingContainer and provides a method
CreateChildControls. I add my custom control to the html of an aspx page,
provide the register directive with a simple assembly name. The custom
control is a private assembly so has a simple dll in the bin directory. All
is fine, with the control rendering its html to the browser until I try and
obtain an object reference using a protected member assignment in the
code-behind class for the containing page as follows;

protected CustomControl myCustomControl;

I get the following compile error;

'The type or namespace name CustomControl could not be found (are you
missing a using directive or assembly reference?)

Any help would be appreciated.
 
S

Sparticus

PS. The object variable myCustomControl is the same string used for the id
attribute for the custom control in the html output.
 
T

Teemu Keiski

You need to reference that assembly so that the type is known at
code-behind. You use VS.NET? Just take reference to it using Add Reference
(it already copies the dll to bin directory)
 
S

Sparticus

Teemu,

Thanks for the reply! No, I am not using vs.net at the moment. Why? you ask.
Well for exaclty this reason. Having come from a J2EE background I like to
learn a technology in full without having an IDE put code in for me. I will
switch to using vs.net when I am confident with the .net framework. Do you
know what 'code' reference I am missing here?

PS My class definition for the composite control declares itself to be in
same namespace as all other project classes!
 
S

Sparticus

OK dudes I have sussed this one out. Since I was compiling my
Composite\Custom control to a seperate assembly, my main assembly required
compiling with the /r to reference the Custom Control assembly. Simple really.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top