Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > reference to Composite Control

Reply
Thread Tools

reference to Composite Control

 
 
Sparticus
Guest
Posts: n/a
 
      12-19-2005
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.


 
Reply With Quote
 
 
 
 
Sparticus
Guest
Posts: n/a
 
      12-19-2005
PS. The object variable myCustomControl is the same string used for the id
attribute for the custom control in the html output.
 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      12-19-2005
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)

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


"Sparticus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Sparticus
Guest
Posts: n/a
 
      12-20-2005
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!
 
Reply With Quote
 
Sparticus
Guest
Posts: n/a
 
      12-20-2005
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Composite vs non composite Controls Mike ASP .Net Web Controls 4 03-11-2005 05:47 AM
Losing Composite Control property that another Composite Control ... Chad ASP .Net Building Controls 0 02-01-2005 09:01 PM
Possible to create a composite control that has a child control that is a validator that validates the composite control itself? Jonathan Eric Miller ASP .Net Building Controls 2 07-22-2004 10:58 PM
Composite control with dynamic composite controls sleigh ASP .Net 1 02-12-2004 06:24 PM
Using Table control in a custom composite control. Control does not render properly in design time. jb_in_marietta@yahoo.com ASP .Net 0 07-01-2003 09:26 PM



Advertisments