.NET Framework - Class of UserControl not found in Page

Asked By Mathias Fritsch
29-Mar-08 05:11 AM
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.


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
B2BShop.Web.Controls
(1)
Visual Studio
(1)
Footer.PrintToPdf
(1)
UserControl
(1)
OnPrintToPdf
(1)
FindControl
(1)
Attribute
(1)
ProductDetail
(1)
  Alex Meleta replied...
29-Mar-08 05:11 AM
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>
  brucebarke replied...
28-Mar-08 01:09 PM
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 replied...
01-Apr-08 10:21 PM
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")
  Juan T. Llibre replied...
30-Mar-08 01:30 PM
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/archive/2005/10/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 :


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 replied...
04-Apr-08 05:34 AM
Thank you all: I added <%@ Reference Control="YourUserControl.ascx"
%>  and things are compiling now!

Mathias
  Juan T. Llibre replied...
03-Apr-08 01:48 PM
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/
======================================
help
that is not what I need. I have tried re-installing Service Pack 1 for Visual Studio 2008. I am really hoping that I will not have to to a un-install of Visual Studio. I am running Windows XP Version 5.1.2600 Service Pack 3 Build 2600 Just in-case it is helpful, I am pasting the info from my Visual Studio about window below * ** ** **ABOUT INFO* ** ** * Microsoft Visual Studio 2008 Version 9.0.30729.1 SP Microsoft .NET Framework Version 3.5 SP1 Installed
6.RTOS.for.Blackfin (1) NASSDA.HANEX.v5.0.01.2005.WINDOWS (1) OPTIS.OPTISWORKS.STUDIO.v2008 (1) NASSDA.HSIM.v5.0.01.2005.WINDOWS (1) 2012 crack software5 download. Please v12.52 Sonnet.Suite.Pro.v12.52.Linux Sono.Scope.v2.8. Sony.Acid.Music.Studio.v7.0a. Sony.Sound.Forge.10.0a. sony.vegas.7.0c sound.soap.1.1 StructureShape.Arch.v1.02 structureshape.frameshape.v1.09 Struds.v2010. StruSoft.FEM-Design.v8.0 Studio.V5.LogoMaker.v2.0. Sucosoft.S40.Ver5.04 Sulcol.v1.0.35. Sulpak.v3.0 Sulsim.6 SULTRAY.SULCOL.C5.2. Sum3D.v7.1 Summit.Design.Visual.Elite.v2006.1.1 Summit.System.Architect.v2006.08.17.Linux Summit.System.Architect.v2006 17.WIN SummitSoft.Business.Cards.Plus.2004. SummitSoft.Label.Designer.Deluxe.2004. Summitsoft.Logo.Design.Studio.v3.5. Sun.Java.Studio.Enterprise.v6.0-Roriso sun.one.studio.v5.1 Sunisoft.IrisSkin.for.NET.Winforms.v3.5. SUPCON.JX-300X.v3.12a Super 00k.Linux SynaptiCAD.Tool.Suite.v12.37a.Linux SynaptiCAD.Tool.Suite.v12.38a. Syncfusion.Essential.Studio.Enterprise.v7.2.0.37. Synchro.Pro.v3.1415.0.0 Synchro.Server.v3.1415
Weiter sind auch die Grenzen und Seiteneffekte von GetWindowText beschrieben. Thorsten D?rfler - - Microsoft MVP Visual Basic vb-hellfire visual basic faq | vb-hellfire - einfach anders http: / / vb-faq.de / | http: / / www.vb-hellfire.de schrieb: Wenn das so w?re, w?re es dokumentiert. Thorsten D?rfler - - Microsoft MVP Visual Basic vb-hellfire visual basic faq | vb-hellfire - einfach anders http: / / vb-faq.de / | http: / / www.vb-hellfire.de Postings schon gef?hrlich, wenn Du Aussagen derart falsch widergibst. Thorsten D?rfler - - Microsoft MVP Visual Basic vb-hellfire visual basic faq | vb-hellfire - einfach anders http: / / vb-faq.de / | http: / / www.vb-hellfire.de Frank Dzaebel schrieb: Genau so kommt das auch r?ber. Thorsten D?rfler - - Microsoft MVP Visual Basic vb-hellfire visual basic faq | vb-hellfire - einfach anders http: / / vb-faq.de / | http: / / www.vb-hellfire.de
functionality? Should SP-1 documentation appear in the Integrated Help Viewer. - - Regards, Fred Chateau fchateauAtComcastDotNet Visual Studio .NET Discussions Visual Studio 2008 (1) FchateauAtComcastDotNet (1) Report (1) Stuido (1) D3c5ff92a373 (1) Accompanies (1) Within 2 (1 real situation, please let me know. You have to install the latest MSDN Library for Visual Studio 2008 SP1 on your machine. It can be downloaded at: http: / / www.microsoft.com / downloads 4ebb- 83c7-d3c5ff92a373&displaylang = en Please keep in mind that the full MSDN Library for Visual Studio is massive - at the current time it is 2GB. If you don't want to
VS .Net Plugin, usability .NET Framework Hi. . . I've got a Visual Studio plugin written in .Net (deriving from IDTExtensibility2, IDTCommandTarget). I've also got a .addin file like the .Net assembly. Are there other programs I can plug it into? thanks Mark Visual Studio Extensibility Discussions Visual Studio .NET (1) Microsoft.Office.Interop.Excel.Workbook (1) Microsoft.Office.Interop.Word.Document (1) Microsoft Office.Interop.Excel (1) EnvDTE.AddIn (1) Microsoft Excel (1) Microsoft Word (1) Visual Studio (1) Good morning Mark The common ground between VS add-in and Office COM add