Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Class of UserControl not found in Page

Reply
Thread Tools

Class of UserControl not found in Page

 
 
Mathias Fritsch
Guest
Posts: n/a
 
      03-28-2008
I am using FindControl in my page and try to cast the control found to
a specific control.

((Controls_Footer)this.Master.FindControl("Footer1 ")).OnPrintToPdf +=
new Controls_Footer.PrintToPdf(Footer1_OnPrintToPdf);

This works but after a while doesnt compile anymore in Visual Studio.

"Type Controls_Footer not found" is the error.

I can then change the web.config to compile in release and it compiles
again - well most of the time.

It compiles without problems on my buildserver which uses a
webdeployment - project.

What is wrong here?

Mathias
 
Reply With Quote
 
 
 
 
Alex Meleta
Guest
Posts: n/a
 
      03-28-2008
Hi Mathias,

Where is the file conained the class 'Contols_Footer' located?

Regards,
Alex Meleta
[Tech Blog: http://devkids.blogspot.com]

MF> I am using FindControl in my page and try to cast the control found
MF> to a specific control.
MF>
MF> ((Controls_Footer)this.Master.FindControl("Footer1 ")).OnPrintToPdf
MF> += new Controls_Footer.PrintToPdf(Footer1_OnPrintToPdf);
MF>
MF> This works but after a while doesnt compile anymore in Visual
MF> Studio.
MF>
MF> "Type Controls_Footer not found" is the error.
MF>
MF> I can then change the web.config to compile in release and it
MF> compiles again - well most of the time.
MF>
MF> It compiles without problems on my buildserver which uses a
MF> webdeployment - project.
MF>
MF> What is wrong here?
MF>
MF> Mathias
MF>


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-28-2008
you a counting on compile batching (compiling pages into one dll) to resolve
reference. you can select rebuild or as you shoudl have done in the forst
place, add a reference to the in page

-- bruce (sqlwork.com)


"Mathias Fritsch" wrote:

> I am using FindControl in my page and try to cast the control found to
> a specific control.
>
> ((Controls_Footer)this.Master.FindControl("Footer1 ")).OnPrintToPdf +=
> new Controls_Footer.PrintToPdf(Footer1_OnPrintToPdf);
>
> This works but after a while doesnt compile anymore in Visual Studio.
>
> "Type Controls_Footer not found" is the error.
>
> I can then change the web.config to compile in release and it compiles
> again - well most of the time.
>
> It compiles without problems on my buildserver which uses a
> webdeployment - project.
>
> What is wrong here?
>
> Mathias
>

 
Reply With Quote
 
Mathias Fritsch
Guest
Posts: n/a
 
      03-30-2008

>
> Where is the file conained the class 'Contols_Footer' located?
>

Alex,
All files are contained in one web. MasterPage and aspx-Page are in
the main folder.

Controls_Footer is located in subfolder called: Controls.

All files use the same namespace: B2BShop.Web.
The aspx and ascx files have a reference which uses the namespace in
the Inherit - Attribute.
(Inherits="B2BShop.Web.Controls_ProductDetail")



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      03-30-2008
re:
!> Controls_Footer is located in subfolder called: Controls.

re:
!> The aspx and ascx files have a reference which uses the namespace in
!> the Inherit - Attribute. (Inherits="B2BShop.Web.Controls_ProductDetail")

Another way to do this is by placing the .ascx file in the App_Code directory.

See:
http://odetocode.com/Blogs/scott/arc...0/01/2293.aspx

....you don't even need a reference, although the ascx source must use inline code.
That isn't practical for you if you use codebehind in the ascx ( some.ascx.cs, for example ).

However, Bruce is right.

If you want to do it the way you're currently doing it, you must include a reference :

<%@ Reference Control="YourUserControl.ascx" %>

The Inherits statement doesn't provide a reference.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
======================================
"Mathias Fritsch" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>>
>> Where is the file conained the class 'Contols_Footer' located?
>>

> Alex,
> All files are contained in one web. MasterPage and aspx-Page are in
> the main folder.
>
> Controls_Footer is located in subfolder called: Controls.
>
> All files use the same namespace: B2BShop.Web.
> The aspx and ascx files have a reference which uses the namespace in
> the Inherit - Attribute.
> (Inherits="B2BShop.Web.Controls_ProductDetail")
>
>
>



 
Reply With Quote
 
Mathias Fritsch
Guest
Posts: n/a
 
      04-03-2008
Thank you all: I added <%@ Reference Control="YourUserControl.ascx"
%> and things are compiling now!

Mathias
 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-03-2008
Good news, Mathias !



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
======================================
"Mathias Fritsch" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank you all: I added <%@ Reference Control="YourUserControl.ascx"
> %> and things are compiling now!
>
> Mathias



 
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
web usercontrol + delegates or specialised usercontrol base class info@record-play.com ASP .Net 0 06-23-2006 09:41 AM
Event not firing in usercontrol inside usercontrol vatech1993@yahoo.com ASP .Net Building Controls 1 12-11-2004 01:28 PM
Event not firing in usercontrol inside usercontrol vatech1993@yahoo.com ASP .Net Building Controls 0 12-10-2004 02:21 PM
Event not firing in usercontrol inside usercontrol vatech1993@yahoo.com ASP .Net Building Controls 0 12-10-2004 02:20 PM
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack huobazi ASP .Net 1 07-03-2003 03:14 AM



Advertisments