Nested user control causes build errors due to missing reference

S

Sebastian Paul

Hi,

I have a user control (EventStructureSelector) used in another user
control (ResultsMenu).

The class EventStructureSelector defines a public type (ModeType),
that is used for one of its properties (Mode). The class ResultsMenu
sets the property of the nested control during the PageLoad event.

No big thing for now.

But when adding the ResultsMenu control to a page, I get a build error
for the page (not the control):
The type 'EventStructureSelector.ModeType' is defined in an assembly
that is not referenced. You must add a reference to assembly
'App_Web_eventstructureselector.ascx.3933a83e.ma7j9ksk,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

Of course, I have correctly registered the ResultsMenu user control,
but that is not enough - I have to register EventStructureSelector!
This is strange, because the page has nothing to do with the nested
control, and the ResultsMenu control already has the Register
directive for EventStructureSelector.

Sure, one can live with it, but a user control should fully
encapsulate the nested controls.

I tried to register both controls globally in the web config, but I
got a similar error.

Best regards, Sebastian
 
B

bruce barker

..net compilers need to load all referenced libraries to do a compile,
thus when asp.net compiles a page, it needs to know this info.

-- bruce (sqlwork.com)
 
S

Sebastian Paul

.net compilers need to load all referenced libraries to do a compile,
thus when asp.net compiles a page, it needs to know this info.
Sure. But it doesn't has this info. The ASP.NET compiler should
recognize the dependency between the controls, shouldn't he?
 

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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top